how to use variables and if else condition in PUG

Viewed 34

I tried to test if condition in PUG as shown bellow. I am not sure why the image is not shown. If i define status='on' it show correctly. any suggestion are welcome.

- var img1 = ""///images/pic_bulbon.gif"
- var status="off"
if status=="on"
    img1="/images/pic_bulbon.gif"
    img(src=img1,width="20",height="40")
    p #{img1}
else
    img1="/images/pic_bulboff.gif"
    p #{img1}
    img(src=img1, width="20", height="40")
0 Answers
Related