|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Wed Oct 14, 2009 11:15 pm
#YESNO and local variables |
Why when I put some code like:
Code: |
$tmp = 0
#YESNO ("Yes or no") {$tmp = 1} {$tmp = 2}
#SA Tmp $tmp |
I always get output "Tmp 0"?
Shouldn't it depends on my decision and the action inside the #YESNO brackets?
Best regards
Yodous |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Thu Oct 15, 2009 4:33 am |
The #YESNO commands actually predates local variables and currently are not compatible with local variables.
|
|
_________________ Asati di tempari! |
|
|
|
oldguy2 Wizard
Joined: 17 Jun 2006 Posts: 1201
|
Posted: Thu Oct 15, 2009 1:20 pm |
If you want to use local variables, do it this way.
Code: |
$tmp = 0
#if (%yesno("Yes or no?")) {$tmp = 1} {$tmp = 2}
#print {The value of tmp is $tmp}
$tmp = %prompt("","Enter a value for tmp:")
#print {The value of tmp is $tmp} |
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Oct 21, 2009 2:01 am |
I went ahead and udpated the help documentation for YESNO.
|
|
_________________ Asati di tempari! |
|
|
|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Wed Oct 21, 2009 10:11 pm |
Thx :)
|
|
|
|
|
|