EnglishРусский  

Ads

Scriptius script builder
Provides the best choice in work automation and great time saving features.

CreateInstall
Freeware and commercial installers

Gentee needs your help!
How to advertise with us
 
laptop battery

return, break, continue instructions

return

The return instruction is used either to return a function value or to terminate the execution of a function. The exit may be from anywhere within the function body, including loops or nested blocks. If the function returns a value, the return instruction is required, furthermore it contains the expression of the appropriate type.

func uint myfunc
{
   ...
   fornum i, 100
   {
      if error : return 0
      ...
   }
   return a + b
}

break

The break instruction terminates the execution of the loop. break is likely to be located within nested blocks. If a program contains several nested loops, break will exit the current loop.

while b > c
{
   for i = 100, i > 0, i--
   {
      if !myfunc( i )
      {
          break   //exit from for
      }
   }
   b++
}

continue

The continue instruction may occur within loops and attempts to transfer control to the loop expression, which is used to increment or decrement the counter (for the following loops: for, fornum, foreach) or to the conditional expression (for while and do-while loops); moreover, the execution of the loop body is not completely executed. The instruction executes only the most tightly enclosing loop, if this loop is nested.

fornum i, 100
{
   if i > 10 && i < 20
   {
      continue 
   }
   a += i // The given expression is not evaluated if i>10 and i<20
}

Related links

Edit