egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare 2 Numbers

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Access
Voice


Joined: 04 Jun 2006
Posts: 22

PostPosted: Wed Jul 26, 2006 9:40 am    Post subject: Compare 2 Numbers Reply with quote

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? Sad
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Wed Jul 26, 2006 11:10 am    Post subject: Reply with quote

use '<' or '>' in if statements
Back to top
View user's profile Send private message Send e-mail
Vexor
Voice


Joined: 21 Jul 2006
Posts: 18
Location: Washington Court House

PostPosted: Wed Jul 26, 2006 1:05 pm    Post subject: Reply with quote

Code:

  if { num1 > num2 } {
                 true
     } else {
                 false
     }


_________________
"just the usual suggestion, RTFM" --demond
Back to top
View user's profile Send private message Visit poster's website
Access
Voice


Joined: 04 Jun 2006
Posts: 22

PostPosted: Wed Jul 26, 2006 6:58 pm    Post subject: Reply with quote

that dont work Sad
whats about the dots in the numbers? thats the reasen that > and < wont work? how to "strip" the dots?
Back to top
View user's profile Send private message
krimson
Halfop


Joined: 19 Apr 2006
Posts: 86

PostPosted: Thu Jul 27, 2006 1:53 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Zero
Voice


Joined: 25 Jul 2006
Posts: 4

PostPosted: Thu Jul 27, 2006 5:38 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber