This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-
Access
- Voice
- Posts: 22
- Joined: Sun Jun 04, 2006 6:31 am
Post
by Access »
I have 2 numbers - eg. 2.200.000.000 & 6.210.000
Now i want to know which number is higher - how do i do that?
-
krimson
- Halfop
- Posts: 86
- Joined: Wed Apr 19, 2006 8:12 am
Post
by krimson »
use '<' or '>' in if statements
-
Vexor
- Voice
- Posts: 18
- Joined: Fri Jul 21, 2006 4:22 am
- Location: Washington Court House
-
Contact:
Post
by Vexor »
Code: Select all
if { num1 > num2 } {
true
} else {
false
}
"just the usual suggestion,
RTFM" --demond
-
Access
- Voice
- Posts: 22
- Joined: Sun Jun 04, 2006 6:31 am
Post
by Access »
that dont work
whats about the dots in the numbers? thats the reasen that > and < wont work? how to "strip" the dots?
-
krimson
- Halfop
- Posts: 86
- Joined: Wed Apr 19, 2006 8:12 am
Post
by krimson »
if you use multiple dots in a number you'd get an invalid number format, so it won't work... don't use the dots
-
Zero
- Voice
- Posts: 4
- Joined: Tue Jul 25, 2006 4:17 am
Post
by Zero »
Code: Select all
set number1 [string map -nocase {"." ""} "2.200.000.000"]
set number2 [string map -nocase {"." ""} "6.210.000 "]
if {$number1 > $number2} {
true
} else {
false
}
Try this