Jump to content

simple but strange problem


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...