User Tools

Site Tools


if

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
if [2013/12/18 09:58]
l [Invalid usage]
if [2017/10/10 00:39] (current)
Line 1: Line 1:
 +<- [[remember|Remembering Things With Variables]] --------- [[nobr|Removing Line Breaks]]->​
 +
 =====<<​if>>​===== =====<<​if>>​=====
  
Line 13: Line 15:
 >​%%<<​%%if //​expression//​%%>>​%% //Text// %%<<​%%else if //​expression//​%%>>​%% //Text// ... %%<<​%%endif%%>>​%% >​%%<<​%%if //​expression//​%%>>​%% //Text// %%<<​%%else if //​expression//​%%>>​%% //Text// ... %%<<​%%endif%%>>​%%
  
-//condition// is an [[expression]] that can evaluate to true or false. //Text// is any amount of passage text that you wish to display only if the condition is //true//. <<​endif>>​ is a macro tag indicating the end of the <<​if>>​ macro invocation.+//expression// is an [[expression]] that can evaluate to true or false. //Text// is any amount of passage text that you wish to display only if the condition is //true//. <<​endif>>​ is a macro tag indicating the end of the <<​if>>​ macro invocation. 
 + 
 +Note that the //Text// can contain any Twine code, including an inner <<​if>>​ invocation:​ 
 + 
 +  <<if $body is "​wounded">>​You are <<if $blood <= 5>>​about to die<<​else>>​bleeding<<​endif>>​. Seek help!<<​endif>>​
  
 ====Motivating example==== ====Motivating example====
Line 93: Line 99:
 (Note: if you prefer, you can also write "else if" as "​elseif"​.) (Note: if you prefer, you can also write "else if" as "​elseif"​.)
 else if else if
 +
 +<- [[remember|Remembering Things With Variables]] --------- [[nobr|Removing Line Breaks]]->​
 +
if.1387360703.txt.gz · Last modified: 2017/10/10 00:37 (external edit)