Please enable JavaScript to view this site.

Vensim Help

The BRANCH control does nothing until it is explicitly referenced by a BRANCH command. txt is used as a label which the BRANCH command should match.

Once the BRANCH control is referenced it replaces the invoking command, adding additional commands and a new shift to screen.  The commands are executed in order just as any other command sequence.  For example:

BUTTON,"Run the model",20,20,0,0,,,IFTHENELSE&TEST>TSUM=100&\
       BRANCH>RUN&SPECIAL>STOP|Numbers must sum to 100,

BRANCH,"RUN",0,0,0,0,,,,RUNNING

Here the IFTHENELSE command causes TEST>TSUM=100 to be checked, if it is true (TSUM is equal to 100) then BRANCH>RUN is executed - sending control the BRANCH control with txt "RUN".  The commands in this control (there are none) are executed and then the new screen RUNNING is shifted to.  If the test failed (TSUM not equal to 100) a stop sign appears, and processing stops.

The labels on BRANCH controls should be unique within a screen, but can repeat from screen to screen.  Only the current screen is tested for the named branch when a BRANCH command is issued.

See the IFTHENELSE, TEST and BRANCH commands for further discussion.