Sign in to follow this  
Followers 0

&= operation

7 posts in this topic

Posted (edited)

Can anyone tell me why am I getting this

[Posicoes]
Vetor=76,,32,,102,,52,,180,,80,,273,,278,,294,,419,,94,,1066,,753,,1055,,447,,1061,,451,,1011,,502,,220,,97,,580,,150,,355,,7,,367,,20,,10,,17

from this code?

Local $oi = $vec[0]
For $i = 1 to 28 Step +1
$oi &= "," & $vec[$i]
Next
IniWrite("Example.ini","Posicoes", "Vetor", $oi)

instead of this

[Posicoes]
Vetor=76,32,102,52,180,80,273,278,294,419,94,1066,753,1055,447,1061,451,1011,502,220,97,580,150,355,7,367,20,10,17
Edited by XuxinhaKill

Share this post


Link to post
Share on other sites



Posted

Sorry, I can't find my crystal ball,.

Share this post


Link to post
Share on other sites

Posted

Firstly you don't need the step +1 as by default a For...Next loop increases by 1 anyway. Secondly, I don't know what the array $vec contains, but look a the code below to give you an idea.

Local $sOutput = ''
For $i = 1 To 28
    $sOutput &= Random(1, 50, 1) & ','
Next
$sOutput = StringTrimRight($sOutput, 1); Trim the last ,
ConsoleWrite($sOutput & @CRLF)

Share this post


Link to post
Share on other sites

Posted (edited)

Or if you don't want to show us more, then use $oi = StringReplace($oi, ',,', ',')

Edited by guinness

Share this post


Link to post
Share on other sites

Posted

I'm only guessing what $vec contains but I suspect this might solve your problem.

Local $oi = $vec[0]
For $i = 1 to 28 Step +1
$oi &= $vec[$i]
Next
IniWrite("Example.ini","Posicoes", "Vetor", $oi)

Share this post


Link to post
Share on other sites

Posted (edited)

I'm only guessing what $vec contains but I suspect this might solve your problem.

I tried what you said and it worked, then I realized that the error wasnt in that part but the content of the array like you and guinness thought...

Thank you guys

Edited by XuxinhaKill

Share this post


Link to post
Share on other sites

Posted

I tried what you said and it worked, then I realized that the error wasnt in that part but the content of the array like you and guinness thought...

Thank you guys

In the future it's best to post what you can, especially since the contents of $vec were important to solving your issue.

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.