Site Tools


do

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

do [2006/07/28 04:10] (current)
Line 1: Line 1:
 +#$EPIC: do.txt,v 1.2 2006/07/26 19:47:17 sthalik Exp $
 +======Synopsis:​======
 +__do__ <​commands>​ \\
 +__do__ { <​commands>​ } [while (<​condition>​)]
 +
 +======Description:​======
 +__DO__ has two uses.  In its first use it is a synonym for [[EVAL]],
 +but it's a bad idea to use [[EVAL]] either.
 +
 +Its second use is a post-test loop.  You are obliged to put your commands
 +in curly braces and after the closing curly brace a [[WHILE]] expression.  ​
 +__DO__ .. [[WHILE]] loops always execute at least once.  You must be careful
 +to put the [[WHILE]] expression on the same line as the closing brace. ​ If 
 +it is on the next line, EPIC will think it is a separate command.
 +
 +======See Also:======
 +To force expansion of some variable $foo:
 +      /do echo the variable $$foo expands to $foo
 +
 +To run the same command in indefinite number of times, but at least once:
 +      assign blah 2
 +      do {
 +         echo $blah is lower than 3
 +      } while ( blah = rand(5) < 3 )
  
do.txt ยท Last modified: 2006/07/28 04:10 (external edit)