JANOS Help System: [Commands] [Topics] [Tech Support] [Printable Manual] [Search]
Script Statements Scripting DESCRIPTION JANOS scripting supports most of the standard control structures. The syntax are consistent with Standard C Language and PHP. Note that multiple statements may be grouped into a single statement using curly braces { }. All forms of commenting are available. // Whitespace is ignored allowing you to format your code as you are // accustomed to doing. if (expr) statement; /* Statements are terminated with a semicolon ';' just like in the C ** Language. In all of these constructs an individual statement may be ** replaced with a group of statements enclosed in curly braces '{}'. ** Format it according to your own standards. */ if (expr) { statement; statement; statement; } // In addition to the one-line C++ style comments the one line // shell-style comment which starts with '#' can be used. if (expr) statement; # executed when expr is TRUE else statement; # The elseif construct is supported if (expr) statement; elseif (expr) statement else statement; /* default condition */ // switch-case statements switch (expr) { case expr1: statement; statement; break; case expr2: statement; statement; break; default: statement; statement; break; } while (expr) statement; // while-loops support single-level 'break' and 'continue'. while { if (expr) break; // exit the loop early statement; } // The do-while form is available. do { statement(s) } while (expr); /* The for-loop follows the C Language implementation. */ for (expr1; expr2; expr3) statement; /* The foreach construct provides an easy way to iterate over arrays. */ foreach (array_expression as $value) statement; foreach (array_expression as $key => $value) statement; /* 'echo' is a native constructs but 'print' is a function. The former ** therefore does not require parentheses although if you like them ** feel free to include them. */ echo expr; echo expr1, expr2, ... ; echo(expr1, ...); /* 'exit' (and its alias 'die') are also native constructs and not ** functions. They therefore do not require parentheses either. With ** these constructs once the expressions have been echoed the rendering ** process terminates. */ exit; exit expr; exit expr1, expr2, ... ; exit (expr1, ...); die; die expr; die expr1, expr2, ... ; die (expr1, ...); SEE ALSO HELP Topics: VARIABLES, SCRIPT [/flash/manpages/program.hlp:495]