Jump to content

transform string in variable?


 Share

Recommended Posts

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

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.

Link to comment
Share on other sites

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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 by golfinhu
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...