Lasso Soft Inc. > Home

[ loop_count ]

Method

[Loop_Count] returns the number of the current repetition of any looping method.

When used with the [Loop] method, it obeys the optional parameters so the [Loop_Count] can run backward or forward by the specified loop increment -By parameter.

This method can be used with the [Loop], [While], or [Records] methods, or any other looping conditional methods. Note: [Loop_Count] cannot be used within an included file to get the current repetition of a method around the [Include] method in the including file. Instead, store the loop count in a variable.

  • Syntax
loop_count
Examples
  • Beginner

To return the number of the current repetition in a looping method:

Use the [Loop_Count] method inside a looping method. The following example shows a loop counting backward from 5.

Code

loop(1, 5, -1)
'<br>This is repetition ' + loop_count
/loop

Result

This is repetition 5
This is repetition 4
This is repetition 3
This is repetition 2
This is repetition 1

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