Pug/Jade conditional AND/&& statement
Asked Answered
M

1

9

I cannot seem to find detailed documentation on conditionals for Pug/Jade contemplating language to use && in a if statement.

I am try to achieve this:

if(true && string == 'saved'){

}

I have also tried using a nested if for those but it does not seem to work either:

if entryopen
  if !submitted
    button

Any help will be greatly appreciated!

Musso answered 7/10, 2016 at 8:14 Comment(0)
U
12

Should be

if entryopen && !submitted
  button

You can change code in this examples. And test it for yourself.

https://naltatis.github.io/jade-syntax-docs/#if

https://pugjs.org/language/conditionals.html

Unfavorable answered 7/10, 2016 at 8:18 Comment(2)
@StefanZeuch what about ones that I provided in answer? Also if this answer is correct marked it as such.Unfavorable
@StefanZeuch you are welcome. By default pug uses JS's syntax for many things. So if there is no information about something in docs try JS syntax first, it will work in many cases.Unfavorable

© 2022 - 2024 — McMap. All rights reserved.