Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do you make an if/else loop?

I am trying to make an adventure story but I need an if/else loop to display some text. Code:
(if: $weapon == true) [
Weapon Strength: $weaponstrength
]

Comments

  • For Harlowe, check this tutorial on conditional statements:
  • @watt274
    Because your $weapon variable contains a Boolean value (true/false) you don't need to compare it to true or false in your (if:) macro, you can do the following instead:
    (if: $weapon) [The weapon variable has a value of true]
    
    (if: not $weapon) [The weapon variable has a value of false]
    
  • @watt274:
    I did not include an example of the (else:) macro in my previous comment because @petithobbit included a tutorial video in their's. I also somehow included an invalid space character between the (macro:) and its associated hook, even though the version in my story project does not!

    The following example is in case you did not watch the video, and have had the invalid spaces characters removed.
    (if: $weapon)[The weapon variable has a value of true]
    (else:)[The weapon variable does not have a value of true]
    
    (if: not $weapon)[The weapon variable has a value of false]
    
Sign In or Register to comment.