I have the following code:
- var a = 5;
- var b = 3;
script
if (a === 5)
if (b === 2)
.
var x = true;
include script.js
I want to include the script.js file when a == 5 and if b === 2, I want to insert a new line var x = true above, inside the tag.
However, when I use the code, the x = true is always inserted.
You can verify it here:

You just need to indent the
.andvar xlines one more level so that they're within the second conditional:If you want
xto always be declared and be either true or false based on your conditions, another approach would be something like this:This will make
xtrue if the Pug variablesaandbare5and2respectively, andfalseif not.