
ptp
USA
Asked
— Edited
@DJ,
The ElseIf is broken:
The code below never stops !
$buffer="[123 456 789]"
$len=Length($buffer)
$ix=0
$start=-1
$end=-1
repeatwhile($ix<$len)
$ch=GetCharAt($buffer, $ix)
if ($ch="[")
print("found start")
$start=$ix
elseif ($start>=0 AND $ch="]")
print("found end")
$end=$ix
# break
$ix=$len+1
endif
print("increment ix")
$ix=$ix+1
endrepeatwhile
print($ix)
print($start)
print($end)
if you remove the ElseIf it works as expected.
$buffer="[123 456 789]"
$len=Length($buffer)
$ix=0
$start=-1
$end=-1
repeatwhile($ix<$len)
$ch=GetCharAt($buffer, $ix)
if ($ch="[")
print("found start")
$start=$ix
endif
if ($start>=0 AND $ch="]")
print("found end")
$end=$ix
# break
$ix=$len+1
endif
print("increment ix")
$ix=$ix+1
endrepeatwhile
print($ix)
print($start)
print($end)
This bug must be recent, i've used before the ElseIf, or did i miss something ?
@Richard R: Last version ?
I am using the latest version of ARC (ARC Version 2017.05.14.00)
I'll take a look
@ptp You are right! I forgot to check the boundary conditions..
$A=3 breaks it with the latest ARC
I get the same "Start" message that you do
Thanks, Frank
Outputs (correct):
Outputs (correct):
Outputs (correct):
@DJ,
It's fixed in your version ? Current version does not work.
I'm using the same version as you.
Your examples are all incorrect - surprised none of you caught any of the incorrectness
If you copy and paste my code into your copy of ARC, you will receive the same output. Copy and paste, do not type it because there's lots of mistakes being made in this thread example code. Such as the $a=11 lol
@DJ:
What is the mistake in the code below ?
the code above produces this: