Lasso Soft Inc. > Home

[ tie->forEach ]


The [tie->foreach] method invokes a capture block on each element in the tie. The method requires a capture block to be passed to it. The capture block is invoked on each element of the tie in turn (i.e. the capture block is invoked with each element of the tie). The current value in the tie can be accessed using the #1 variable.

  • Syntax
#myTie->forEach => {	
  • Beginner

Sum tie

This example calculates the sum of each item in the tie. The sum is output.


local( total = 0 );
local( myTie = tie( array( 1, 2, 3, 4, 5 ), list( 6, 7, 8, 9, 10 ) );

#myTie->forEach => {
	#total += #1;	// Add to sum
} // Close forEach




Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft