Jump to content

Recommended Posts

Posted

noob question for sure.

$var = 0

$var = $var + 1

why is it that its creating 1111111111, instead of 1 2 3 4 5 6 7..... like i want it to?

Posted (edited)

This:

$var = 0
$var = $var + 1
$var = $var + 1 ;; etc

Will NOT produce "11...etc". (not even if you used quoted value's) ... your probably using '&' instead of '+' in your real code.

Tip:

Show your real code instead of your interpretation of what you think your/the code is doing.

(apply's to all, just double, or even triple, for beginners ... or noob's if you like.)

Edited by iEvKI3gv9Wrkd41u

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Posted

The addition operation is not treated as string concatenation in the AutoIt language. Try these examples

$var = 1
$var = $var + 1
MsgBox(64, "Test 1", $var)

$var = "String"
$var = $var + 1
MsgBox(64, "Test 2", $var)

$var = "String"
$var = $var + "1"
MsgBox(64, "Test 3", $var)

If the addition operation is used with strings, then the statement is evaluated using the numerical representation of the expression contained in the string. To see/understand the numeric representation of several string expressions see the Number() function in the help file.

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
×
×
  • Create New...