Please enable JavaScript to view this site.

Vensim Help

IFTHENELSE should appear by itself.  It signals that the next three commands are for a logical branching sequence.  The first command following IFTHENELSE is executed.  If it returns a nonzero value (TRUE) then the second command following is executed, otherwise the third command is executed.  IFTHENELSE is normally followed by a TEST command and then a BRANCH command as in:

BUTTON,"Simulate",90,50,0,0,C,,IFTHENELSE&TEST>WSUM=100&BRANCH>OK&\

STOP|Weights must sum to 100

BRANCH,"OK",0,0,0,0,,,,RUN

IFTHENELSE does not need to be the first command, but you will get an error message if IFTHENELSE is followed by any number of commands other than 3.  If there is a shift to screen named on a line with ITTHENELSE that screen will be shifted to unless a BRANCH command is executed.