User Tools

Site Tools


foreach_arrayed_looping_construct_.htm
Navigation:  Clarion.Net (Clarion#) > Clarion# Language Extensions > Control Structures >====== FOREACH (arrayed looping construct) ====== Previous pageReturn to chapter overviewNext page
label FOREACH ( element IN object/array )
Statements
YIELD (expression)
END

blk2blue.jpg

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.

foreach_arrayed_looping_construct_.htm.txt · Last modified: by 127.0.0.1