===== If / Then (Statement) ===== INPUT "MARKS", M IF M<75 THEN PRINT "ADMIT" END IF ==== Format ==== **if** [[booleanexpressions|boolean_expression]] **then** [[programsyntax|statement]]\\ **if** [[booleanexpressions|boolean_expression]] **then** [[programsyntax|statement]] **else** [[programsyntax|statement]] \\ **if** [[booleanexpressions|boolean_expression]] **then** [[compoundstatementprogramsyntax|compound_statement]]\\ **if** [[booleanexpressions|boolean_expression]] **then** [[compoundstatementprogramsyntax|compound_statement]] **else** [[compoundstatementprogramsyntax|compound_statement]] \\ ---- **if** [[booleanexpressions|boolean_expression]] **then**\\ [[programsyntax|statement(s)]]\\ **end if** ---- **if** [[booleanexpressions|boolean_expression]] **then**\\ [[programsyntax|statement(s)]]\\ **else**\\ [[programsyntax|statement(s)]]\\ **end if** ==== Description ==== A single line IF evaluates //booleanexpr//, when true the [[programsyntax|statement(s)]] following the then is executed, otherwise execution continues on the next line. There are also two forms of a multi-line if statement, one with a true block and one with a true and a false block of code to execute. ==== Example ==== print "Guess my letter - press a key" # wait for the user to press a key do a = key pause .01 until a <> 0 # if chr(a) = "Z" then print "Yippie, you pressed the Z key!!!" else print "darn, you pressed something else." end if # end ==== History ==== |0.9.4g|Multiple line If/Then/Else/EndIf| |1.1.0.0|Added single line If/Then/Else|