golfinhu Posted January 14, 2011 Posted January 14, 2011 (edited) hi people, I have to turn string into variables? example Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 Switch $i Case 1 $1 += 1 Case 2 $2 += 1 Case 3 $3 += 1 Case 4 $4 += 1 Case 5 $5 += 1 Case 6 $6 += 1 Case 7 $7 += 1 Case $8 $8 += 1 Case 9 $9 += 1 Case 10 $10 += 1 EndSwitch Next this code is to long :s i need something simpler e.g Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 '$' & $i += 1 Next but this return a string, not a varible =S anyone knows how to do it? thanks a lot Edited January 14, 2011 by golfinhu
Newb Posted January 14, 2011 Posted January 14, 2011 hi people, I have to turn string into variables? example Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 Switch $i Case 1 $1 += 1 Case 2 $2 += 1 Case 3 $3 += 1 Case 4 $4 += 1 Case 5 $5 += 1 Case 6 $6 += 1 Case 7 $7 += 1 Case $8 $8 += 1 Case 9 $9 += 1 Case 10 $10 += 1 EndSwitch Next this code is to long :s i need something simpler e.g Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 '$' & $i += 1 Next but this return a string, not a varible =S anyone knows how to do it? thanks a lot Don't got very well your code, but you can do that with Number(). Check help file I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.
UEZ Posted January 14, 2011 Posted January 14, 2011 Try this: Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 Assign($i, $i + 1) ConsoleWrite(Eval($i) & @CRLF) Next Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
golfinhu Posted January 14, 2011 Author Posted January 14, 2011 Don't got very well your code, but you can do that with Number(). Check help file no, i need return the number with variable if the $i = 1 then the variable $1 have to add 1 if $i = 1 then $1 += 1 if $i = 2 then $2 += 1 if $i = 3 then $3 += 1 etc, i do not want to put as many "if"
golfinhu Posted January 14, 2011 Author Posted January 14, 2011 (edited) Try this: Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 Assign($i, $i + 1) ConsoleWrite(Eval($i) & @CRLF) Next Br, UEZ Great! result: Local $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0 , $8 = 0, $9 = 0, $10 = 0 for $i = 1 to 10 Assign($i, Eval($i) + 1) ConsoleWrite('$' & $i & '= ' & Eval($i) & @LF) Next thankyou so much! Edited January 14, 2011 by golfinhu
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