Project

General

Profile

Up

forTab

forTab is a for-like from any array. This is a polymorphic function.

Prototype :

fun [fun [u0 I] u1 tab u0] I

  • fun [u0 I] u1 : function called to each item. Arguments are : the value and the index
  • tab u0 : any array

Return : I 0 if no error occurs during the loop, else nil

IMPORTANT : if function returns nil, the loop stops, similar at a 'break' instruction.

See also :

forI

forlist

tabRange

tabRangeF

tabExtract

Example

typeof myTab = tab I;;
	
fun fDisplayTab (item)=
	_fooId item;;	// 1 3 5 7 9

fun main ()=
	_showconsole;
	set myTab = tabRange 1 5 2;	// tabRange creates an integer array (tab) from an initial value, a size and an incremention value
	forTab @fDisplayTab myTab;
	0;;

Note : if you need more arguments to 'fDisplayList', you can use mkfunX function(s) or use global(s) variable(s).