Do Statement

The do statement executes until the condition becomes true. The syntax of the do statement is:

do
  statements
loop until expression

statements are executed repeatedly until expression evaluates true. expression is evaluated after each iteration, so the loop will execute statements at least once.

Here is an example of calculating scalar product of two vectors, using the do statement:

s = 0
i = 0
do
  s = s + a[i] * b[i]
  i = i + 1
loop until i = n
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code