Jump to content
Sign in to follow this  
ForexGG

simple but strange problem

Recommended Posts

ForexGG

here is my code

$QUOTE_STA = IniRead("test.ini", "QUOTE", "QUOTE_STA", "NONE")
$QUOTE_END = IniRead("test.ini", "QUOTE", "QUOTE_END", "NONE")

MsgBox(0,"",$QUOTE_END & "  " & $QUOTE_STA)
MsgBox(0,"", $QUOTE_END >= $QUOTE_STA)

Read in $QUOTE_END is 100 and $QUOTE_STA is 99.05

why the results gives me false?

Below is my test.ini file

[QUOTE]
QUOTE_STA = 99.05
QUOTE_END = 100

Share this post


Link to post
Share on other sites
ForexGG

I can put Number($QUOTE_END) to make it ture, but why should I do that?

Share this post


Link to post
Share on other sites
Jos

I can put Number($QUOTE_END) to make it ture, but why should I do that?

Because else you are comparing 2 strings, so you need to convert it to a number when reading from the INI file.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
ajag

I can put Number($QUOTE_END) to make it ture, but why should I do that?

I think because of this:

'1' < '2' < '3' < ... < '9' < 'a' < 'b' < 'c' ...

(Variables are basicaly Variant, not Numbers)


Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.