Jump to content



Photo

&= operation


  • Please log in to reply
6 replies to this topic

#1 XuxinhaKill

XuxinhaKill

    Seeker

  • Active Members
  • 32 posts

Posted 19 September 2012 - 09:31 PM

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, 19 September 2012 - 09:31 PM.








#2 JohnOne

JohnOne

    Number #1

  • Active Members
  • PipPipPipPipPipPip
  • 14,336 posts

Posted 19 September 2012 - 09:35 PM

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

AutoIt Absolute Beginners    Require a serial    Pause Script    

 

Monkey's are, like, natures humans.


#3 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 18,153 posts

Posted 19 September 2012 - 09:36 PM

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)

UDF List:
Spoiler
Updated: 31/03/2015

#4 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 18,153 posts

Posted 19 September 2012 - 09:37 PM

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

Edited by guinness, 19 September 2012 - 09:38 PM.

UDF List:
Spoiler
Updated: 31/03/2015

#5 Bowmore

Bowmore

    Feinschmecker

  • Active Members
  • PipPipPipPipPipPip
  • 856 posts

Posted 19 September 2012 - 11:02 PM

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)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

#6 XuxinhaKill

XuxinhaKill

    Seeker

  • Active Members
  • 32 posts

Posted 19 September 2012 - 11:49 PM

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, 19 September 2012 - 11:49 PM.


#7 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 18,153 posts

Posted 20 September 2012 - 11:31 AM

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.
UDF List:
Spoiler
Updated: 31/03/2015




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users