PB Survival guide A must read!!!
Posted: Sun Aug 21, 2016 6:07 pm
Hi to all Just looking through Blueznl Survival Guide and came across C shorthand stuff and was just looking how i could apply that shorthand. How about a multi variable for loop ?
The Idea is to use 3 possible iteration integers based on the result of 2 variables a,b with the 3 possible results being based on = < >
May come in useful for some, I quite like the idea! Thanks Blueznl
Updated as a macro.
Because it uses bitwise OR more than one result would give the wrong result. So the Operators are built into the macro with = < > supported.
Zebuddi. 
The Idea is to use 3 possible iteration integers based on the result of 2 variables a,b with the 3 possible results being based on = < >
May come in useful for some, I quite like the idea! Thanks Blueznl

Updated as a macro.
Because it uses bitwise OR more than one result would give the wrong result. So the Operators are built into the macro with = < > supported.
Code: Select all
a = 3 : b = 23
;if a = b loop 30 if a < b loop 120 if a > b loop 60
Macro VarLoop(Var_A, Var_b, Multiplier_integer, Equals_Iteration, LessThan_Iteration, GeaterThan_Iteration)
( (Multiplier_Integer * (Bool( Var_A = Var_B) * Equals_Iteration)) | (Multiplier_Integer * (Bool( Var_A < Var_B) * LessThan_Iteration)) | (Multiplier_Integer * (Bool( Var_A > Var_B) * GeaterThan_Iteration)) )
EndMacro
CallDebugger
For i = 1 To VarLoop(a, b, 6, 20, 10, 5)
Debug i
Next
