FOREACH (arrayed looping construct)

Top  Previous  Next

 

label

FOREACH ( element IN object/array )

 

Statements

 

YIELD (expression)

 

END

 

FOREACH

Test every element in a defined array

element

The reference to each array element

IN

Required clause in FOREACH that separates the element from the array.

object/array

the label of the target array

YIELD

Returns an expression

 

FOREACH is used to loop through a target array of elements. YIELD appears only inside the FOREACH block and returns the value that is expected by the calling FOREACH statement. Multiple YIELD statements are permitted.

 

Example:

 

MainForm.MnuProductClick PROCEDURE(System.Object sender, System.EventArgs e)

Frm  &System.Windows.Forms.Form

FrmFound BOOL

 

CODE

 FrmFound = FALSE

 Frm &= NULL

 FOREACH Frm IN SELF.MdiChildren

  IF Frm IS Warehouse.ProductsBrowseForm THEN

   FrmFound = TRUE

   BREAK

  END

 END

 IF FrmFound THEN

  Frm.Activate()

 ELSE

  Frm &= NEW Warehouse.ProductsBrowseForm

  Frm.MdiParent &= SELF

  Frm.Show()

 END

 

1.