wili
22nd February 2011 10:17 UTC
Problem with loop condition
Hi
I don't figure out, why my loop condition doesn't work.
Here is my code:
StrLen $length $value
Messagebox MB_OK "length: $length"
${LoopUntil} ($length == 0)
When using $length = "0" or $length == "0" I always get an error when compiling my script.
When using $length != 0 the loop terminates as soon as the length is bigger then 0.
But using $length == 0 doesn't abort the loop, when the length variable is "0".
What is the right syntax in this case?
Thanks for your help and best regards,
Marco
jpderuiter
22nd February 2011 10:26 UTC
From LogicLib example:
StrCpy $R1 0
StrCpy $R2 ""
${Do}
StrCpy $R2 $R2$R1
IntOp $R1 $R1 + 1
${LoopUntil} $R1 >= 5
From LogicLib Wiki:
Standard (built-in) string tests (which are case-insensitive):
a == b; a != b
Standard (built-in) signed integer tests:
a = b; a <> b; a < b; a >= b; a > b; a <= b
wili
23rd February 2011 07:19 UTC
Thanks for your fast replay.
I already knew the helps.
The solution is, never use brackets for the conditions!!
${LoopUntil} ($length == 0) doesn't works
${LoopUntil} $length == 0 works!!
Thanks for the help anyway!
Regards