Hi !!!
I very newbie question here, but when I read the post about declaring integers and float numbers, I have this doubt.
If I do this:
Global my_Number%
And I use in the loop whit , inc my_Number,2 (whit out the percent symbol) or any other action...
Now my number it's an Integer... I have to put the '%' or I can keep out
if I don't write '%' GLBasic things it's the same like my_Number%
Thanks
I am not really sure if i understand your question, but as far as i know its this:
When you declare a variable the first time (no matter if it s GLOBAL or LOCAL), you need to declare it as integer (%) or Float. So if you want an integer you need to add the % when you declare it. Later in your code there is no need to add the % again, since the compiler already knows that this variable is an integer.
Did this answer your question?
As kanonet said once declared for the 1st time the variable stays that type, so if you use LOCAL score% (or GLOBAL) then update score later on without adding the % symbol glb will still treat it as an integer.
I normally still add the % or # to the variable name in the rest of the code as it helps when coming back to code that I have not used in a while, basically saves me having to scroll back & forth to check what the variable was initially declared as.
Of course it is down to personal preference what way works best for you.
Lee
Sent from my GT-I5700 using Tapatalk 2
hi guys thanks a lot!!!
Yes kanonet your answered my question =D :booze:
& fuzzy70 thanks a lot!!! you clarify a bit more the question... I put in all my Code, but I think it's more nice putting % and #.
Thanks very helpfully for my newbie skills...
:booze: :booze: :booze: