while statement

Purpose: This command executes the statements defined within its body until the condition specified evaluates to true as soon as the condition evaluates to false looping stops.

Status: Done.Nesting is not supported at the moment.

Syntax:

   while condition
   ...
   end

Let's see some examples of this command.

Example 1:

  
   param a=5
   while a>0
     echo a is :
     measure a eval(a-1)
   end

Output:

    a is:
    a= 4.
    a is:
    a= 3.
    a is:
    a= 2.
    a is:
    a= 1.
    a is:
    a= 0.

Example 2:

  while 1
    echo I'll run infinite times.
  end

Output:

  gnucap> I'll run infinite times.
          I'll run infinite times.

and,this statement will execute infinite times!!

gnucap/user/while_statement.txt · Last modified: 2015/12/11 15:39 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki