# [Twine 2.1/Sugarcube 2] if variable less then X but not 0

0 votes
asked Dec 30, 2017

Hello again!

This time is a lot simpler question.

I am trying to make a variable that if lt 15 but not 0. I want 0 to do another variable.

Example:

<<if \$Variable lt 15 (but not) 0>>it is less than 15 but not 0<<if>>

<<if \$Variable is 0>>It is 0<</if>>

## 1 Answer

+1 vote
answered Dec 31, 2017 by (43,200 points)

Did you mean, literally, less than 15 and not 0 or, more likely, greater than 0 and less than 15?  Here are examples of both:

``````→ Not 0 and and less than 15.  Range of -Infinity to 15, excluding 0.
<<if \$Variable isnot 0 and \$Variable lt 15>>
less than 15, excluding 0
<<elseif \$Variable is 0>>
exactly 0
<</if>>

→ Greater than 0 and less than 15.  Range of 1 to 14.
<<if \$Variable gt 0 and \$Variable lt 15>>
less than 15 and greater than 0
<<elseif \$Variable is 0>>
exactly 0
<</if>>``````

commented Dec 31, 2017 by (390 points)
Worked like a charm!

Thanks for helping me so much!