|
Matthew Beginner
Joined: 22 May 2003 Posts: 18 Location: Germany
|
Posted: Fri Apr 30, 2004 12:29 pm
Boolean Variable |
Hi,
I wanna make a little training alias using a boolean variable to control it.
Therefor I thought of a while loop with a boolean variable. But my little test alias below isn't working correctly.
It runs even when the variable is set to false.
#VAR A 10
#WHILE (@wtrain) {
#SHOW @A
#ADD A -1
#wait 3000
}
Can you help me?
Matthew |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Apr 30, 2004 6:08 pm |
When you put the string "false" in a variable, it is simply a string and not a boolean value. Since it's not a null string, the string "false" evaluates to true.
Use 0 when you want to put a false value into a variable.
An ALARM would probably be a much better choice than a WHILE and WAIT.
#VAR A 10
#VAR wtrain 1
#ALA *3 {#IF (@wtrain) {#SHOW @A;#ADD A -1}} |
|
|
|
Matthew Beginner
Joined: 22 May 2003 Posts: 18 Location: Germany
|
Posted: Sat May 01, 2004 4:18 pm |
Thanks for the help.
Working with 1 and 0 is doing it.
Only the alarm idea doesn't fit in my concept.
But thanks anyway. Perhaps I'll need it sometimes.
Matthew |
|
|
|
|
|