Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Handling the spaces produced in a multi-line if statement

$
0
0
I am using Sugarcube and I have an issue with the following code structure:
<<nobr>>
<<if $var1 neq "">>
You have a <<print $var1>>
<<else>>
You have nothing
<</if>>
<<if $var2 neq "">>
and you have an ally, <<print $var2>>, with you.
<<else>>
.
<</if>>
<<endnobr>>

In the case that $var1 equals "" and $var2 also equals "", the resulting sentence will look like this:
You have nothing .

The only way I've been able to get rid of that space between the "nothing" and the "." is to restructure the above code like so
<<nobr>>
<<if $var1 neq "">>
You have a <<print $var1>><<else>>
You have nothing<</if>><<if $var2 neq "">>and you have an ally with you.<<else>>.<</if>>
<<endnobr>>
but as you can see, that's quite unsightly.
Is there any more graceful way to prevent the if statement from generating that annoying space?

Viewing all articles
Browse latest Browse all 1844

Trending Articles