while ( : : Condition : )

Continue to execute the body as long as the condition is true.

while executes the body as long as the condition is true. The while loop has a boolean expression as the conditional part. As long as it is true (i.e., not equal 0), the body of the loop is performed. In order to enter the loop, the condition has to be true in the first place.


Parameters

Condition (input_control)
integer -> integer
Condition for loop.


Example
dev_update_window ('off')
dev_close_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowID)
read_image (Image, 'particle')
dev_display (Image)
stop ()
threshold (Image, Large, 110, 255)
dilation_circle (Large, LargeDilation, 7.5)
dev_display (Image)
dev_set_draw ('margin')
dev_set_line_width (3)
dev_set_color ('green')
dev_display (LargeDilation)
dev_set_draw ('fill')
stop ()
complement (LargeDilation, NotLarge)
reduce_domain (Image, NotLarge, ParticlesRed)
mean_image (ParticlesRed, Mean, 31, 31)
dyn_threshold (ParticlesRed, Mean, SmallRaw, 3, 'light')
opening_circle (SmallRaw, Small, 2.5)
connection (Small, SmallConnection)
dev_display (Image)
dev_set_colored (12)
dev_display (SmallConnection)
stop ()
dev_set_color ('green')
dev_display (Image)
dev_display (SmallConnection)
Button := 1
while (Button = 1)
  dev_set_color ('green')
  get_mbutton (WindowID, Row, Column, Button)
  dev_display (Image)
  dev_display (SmallConnection)
  dev_set_color ('red')
  select_region_point (SmallConnection, SmallSingle, Row, Column)
  dev_display (SmallSingle)
  NumSingle := |SmallSingle|
  if (NumSingle=1)
    intensity (SmallSingle, Image, MeanGray, DeviationGray)
    area_center (SmallSingle, Area, Row, Column)
    dev_set_color ('yellow')
    set_tposition (WindowID, Row, Column)
    write_string (WindowID, 'Area='+Area+', Int='+MeanGray)
  endif
endwhile
dev_set_line_width (1)
dev_update_window ('on')

Result

while returns 2 (H_MSG_TRUE) if the evaluation of the expression yields no error. endwhile (as operator) always returns 2 (H_MSG_TRUE)


Parallelization Information

while is reentrant, local, and processed without parallelization.


Alternatives

for


See also

if, ifelse


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH