IF Argument @{" OPERATOR " link "operator"} Argument ELSEIF, ELSE, ENDIF AND, OR This is the standard If/Else/EndIf stuff, common in any computer language. The way to use it, is to think logically. var = 1 IF \$var = 2 OR \$var = 3 say 'var = 2 or 3\n' ELSEIF \$var = 5 AND \$var = 1 say 'var = 1 and 5\n' ELSEIF \$var = 1 say 'var = 1 - correct\n' ELSE say 'don't know..\n' ENDIF The above should print out 'var = 1 - correct' Rules of the game : - In any if construct, you MUST start with IF and end with ENDIF. - In between you may use only one ELSE - You can have as many ELSEIF's as you want - only the commands attached to the 1st ELSEIF which satisfies the criteria will be executed. - You can have many AND or OR statements - these MUST follow exactly after an IF or ELSEIF or ELSE. - You can have if within if within if constructs, up to 126 levels. If you don't understand how it works, run gui4cli in debug mode. This will show you what it's doing. The Arguments can be strings, or numbers or variables. Note that if you want to compare a variable you MUST place a \$ character in front of it (to indicate that you mean the contents of the variable). See the OPERATOR explanation to see what operators you can use. IF (as well as WHILE etc) is smart enough to understand the comparison of Numbers. So if you compare : IF 2 > 10 ...the answer will be FALSE, since 2 is less than 10, although if they were compared strictly as strings 2 would be more that 10. IF can also be replaced by the IFEXISTS command. This has different arguments (see its explanation), but otherwise replaces IF in every way. IMPORTANT : The most common mistake I make when writing GUIs is this : If variable = 10 <- This compares 10 to the name of the variable instead of : If \$variable = 10 <- Correct. Compares 10 to the contents of "variable" Example : @{" Run Gui " system "gui guis:docs/tutorials/IfTest.gc"} @{" Source " link "guis:docs/tutorials/IfTest.gc/Main"}