Sign in to follow this  
Followers 0
Guest thandor32

Why Is 9 < 11 = False

3 posts in this topic

Hi there,

i got a slight problem with one of my scripts:

I read data from a webpage (digits) by copying it into the clipboard and then pasting it into variables.

Variable $a gets assigned 9 this way and variable $b is 11.

Before comparing the 2 i check their content with a msgbox which gives me the correct resulst: $a = 9 and $b = 11

Still: if $a < $b then msgbox... doesnt get triggered

any ideas why this could be the case ? I suspected this was because i used StringMid to read the digits from the clipboard, but if i use StringIsDigit on $a or $b it says true.

Share this post


Link to post
Share on other sites



They are being compared as strings. Cast them to numbers.

$a = Number($a)
$b = Number($b)

Share this post


Link to post
Share on other sites

thanks a lot, u saved my day :D

i thought it could be something like this, however it worked fine all the time till now (luck on my side most probably)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0