Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Scriptol/If Control Structure

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

If Control Structure Common syntax For a conditional process, the statement is a "if" keyword, followed by a boolean expression, a list of statements to execute or no, depending of the condition, and the "/if" keyword. If x = 5 print "equal" /if Introducing an alternative by the "else" keyword: when the condition is false, another list of statements may be processed. If x = 5 print "equal" else print "not equal" /if One-line structure When the body of the structure is just one statement, and not another structure, the syntax may be shortened to only a single line. If x = 5 print x If the statement is not a command as "print", "break", "continue" etc..., the "let" keyword is required. If x = 5 let y + 1 Composite if The structure may be extended into a more powerful construct that is both an "if" and a "switch case" structure, even more advanced than the C counterpart since you can test any type of variable. if x = 5: print "equal" > 5: print "more" else print "less" /if