| View previous topic :: View next topic |
| Author |
Message |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Wed Jul 26, 2006 9:40 am Post subject: Compare 2 Numbers |
|
|
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?  |
|
| Back to top |
|
 |
krimson Halfop

Joined: 19 Apr 2006 Posts: 86
|
Posted: Wed Jul 26, 2006 11:10 am Post subject: |
|
|
| use '<' or '>' in if statements |
|
| Back to top |
|
 |
Vexor Voice

Joined: 21 Jul 2006 Posts: 18 Location: Washington Court House
|
Posted: Wed Jul 26, 2006 1:05 pm Post subject: |
|
|
| Code: |
if { num1 > num2 } {
true
} else {
false
}
|
_________________ "just the usual suggestion, RTFM" --demond |
|
| Back to top |
|
 |
Access Voice
Joined: 04 Jun 2006 Posts: 22
|
Posted: Wed Jul 26, 2006 6:58 pm Post subject: |
|
|
that dont work
whats about the dots in the numbers? thats the reasen that > and < wont work? how to "strip" the dots? |
|
| Back to top |
|
 |
krimson Halfop

Joined: 19 Apr 2006 Posts: 86
|
Posted: Thu Jul 27, 2006 1:53 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
Zero Voice
Joined: 25 Jul 2006 Posts: 4
|
Posted: Thu Jul 27, 2006 5:38 am Post subject: |
|
|
| Code: |
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 |
|
| Back to top |
|
 |
|