DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....

## DLabPascal - Control Structures

 Command Explanation & Details begin  end; Defines a block of statements; in general, the begin...end block can be omitted if the block of statements consists only of a single statement. if   then   else ; Decision based on the boolean value of the expression expr. If expr evaluates to a TRUE state the then clause is executed (statement 1), if expr results in FALSE then else clause is executed (statement 2). for to do  begin    end; The for statement assigns the value of StartIx to the counter Cnt, then executes statements repeatedly, incrementing the counter after each iteration until it reaches EndIx. Please note that the parameter StartIx has to be less than or equal to EndIx, otherwise statements will never be executed. for downto do  begin    end; The for statement assigns the value of StartIx to the counter Cnt, then executes statements repeatedly, decrementing the counter after each iteration until it reaches EndIx. Please note that the parameter StartIx has to be greater than or equal to EndIx, otherwise statements will never be executed. while do  begin    end; A while statement is a loop structure which evaluates the control condition expr before the first execution of the statement sequence. Hence, if the expr is false, the statement sequence is never executed. case of  alt1: ;  alt2: ;  alt3: ;  ...  else end; The case statement provides a more readable alternative to deeply nested if statements. The selector expr is any expression of an ordinal type, the alternatives alt1..altN must be of the same type as the selector. If none of the alternatives matches the selector expression, then the statements in the else clause (if there is one) are executed. repeat  until ; The repeat statement executes its sequence of constituent statements continually, testing expr after each iteration. When expr returns True, the repeat statement terminates. The sequence is always executed at least once, because expr is not evaluated until after the first iteration.