Flow control


As almost every scripting language, XSH2 supports subroutines, various conditional statements, loops and even exceptions.

Related Topics

command-or-block
single XSH2 command or a block of XSH2 commands
call
indirect call to a user-defined routine (macro)
def
sub-routine declaration
do
execute a given block of commands
eval
evaluate given expression as XSH commands
exit
exit XSH2 shell
foreach
loop iterating over a node-list or a perl array
if
if statement
ifinclude
conditionally include another XSH2 source in current position
include
include another XSH2 source in current position
iterate
iterate a block over current subtree
last
immediately exit an enclosing loop
next
start the next iteration of an enclosing loop
prev
restart an iteration on a previous node
redo
restart the innermost enclosing loop block
return
return from a subroutine
run-mode
switch into normal execution mode (quit test-mode)
stream
process selected elements from an XML stream (EXPERIMENTAL)
test-mode
do not execute any command, only check the syntax
throw
throw an exception
try
try/catch statement
undef
undefine sub-routine or variable
unless
negated if statement
while
simple while loop