aa_macro syntax 
 aa_macro source 
 HTML source 
 HTML render 
Key

§ 4.89 - [stage] Built-In

Mnemonic aid: stage for STAGEd loop operations

See also:  [abs] ,  [add] ,  [dec] ,  [div] ,  [inc] ,  [int] ,  [max] ,  [min] ,  [mul] ,  [random] ,  [round]  and  [sub] 

Allows you to produce values through a range from start to end by specifying how many steps there are in the range, and what step to produce a floor(integer) or floating point result for. mode= is integer by default, and digits= (fractional part of float result) is 2 by default. This built-in is generally intended to be used with  [repeat] 

In the example below, there are four styles that together make up a very controllable looping construct. In  {mitt} , the output of the series as generated by  [stage]  is caught and you can do whatever you like with it. Here,  {mitt}  just outputs it (and snoops on and adjusts the displayed value of) the iterated counter variable, mycount, but obviously the number of uses for loops are endless.


[stage (mode=float,)(digits=N,)start end steps step]

[stage 100 50 10 5]
[stage 50 75 10 5]
[stage mode=float,0 1.5 3 2]
[stage mode=float,0 10 3 1]
[stage mode=float,digits=6,0 10 3 1]
[stage mode=float,0 1 10 5.5]

[style lowstage [repeat [parm 1] {mitt [stage [parm 2] [parm 3] [parm 4] [vinc pre=1,[parm 5]]]}]]
[style nstage [split [co],[b]][local [parm 5] [parm 0]]{lowstage}]
[style mitt Caught a [b] on [nd [dec [v mycount]]] iteration[nl]]

nstage: startCount=1 stepsToTake=5 start=5 end=10 steps=5 countVariable
{nstage 1,5,5,10,5,mycount}

75
62
1.00
3.33
3.333333
0.55

nstage: startCount=1 stepsToTake=5 start=5 end=10 steps=5 countVariable
Caught a 6 on 1st iteration
Caught a 7 on 2nd iteration
Caught a 8 on 3rd iteration
Caught a 9 on 4th iteration
Caught a 10 on 5th iteration

75 62 1.00 3.33 3.333333 0.55 nstage: startCount=1 stepsToTake=5 start=5 end=10 steps=5 countVariable Caught a 6 on 1st iteration Caught a 7 on 2nd iteration Caught a 8 on 3rd iteration Caught a 9 on 4th iteration Caught a 10 on 5th iteration

Other built-ins used here:  [b] ,  [co] ,  [dec] ,  [local] ,  [nd] ,  [nl] ,  [parm] ,  [split] ,  [style] ,  [v]  and  [vinc] 

Keyboard Navigation
, Previous Page . Next Page t TOC i Index

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses Python 2.7