polps Posted October 21, 2010 Share Posted October 21, 2010 Hello,I have a question about the variable datatype.I know that AutoIT has only one datatype called "Variant".So, wich is the correct expression I have to use in the following situation1) If $var == 100 Then ...or 2) If $var == "100" Then ...Thanks Link to comment Share on other sites More sharing options...
bogQ Posted October 21, 2010 Share Posted October 21, 2010 (edited) depends if you mix number with string or not i learned hardwayrelated threadIf your $var is numeric tupe then its best not to compare it to "100" Edited October 21, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
polps Posted October 21, 2010 Author Share Posted October 21, 2010 Tanks bogQ.I red your post and I undestood that if I use a mathematical operator all the value are converted in numbers by AutoIT engine.The == operator, using numbers, has the same effect as the = operators.Regarding the $var in my example, it can be a number if I make a direct assign (e.g. $var = 100) but it can be a string if I read this value in a text file (e.g. $var = FileReadLine... ) and so on.So my conclusion is:Regardless the way you assign the variable value, the datatype is converted automatically by the AutoIT engine depending the considered expression.Are my conclusion correct? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now