11-19-2018, 10:31 PM
Hey guys, just trying to contribute a bit. I really do like my HP Prime but have recently found an issue.
When using the break or continue statements in both Home and CAS modes, nested loops will show the same effect, e.g. when you use this in home mode:
Or, the same in CAS mode:
You will get the same result:
But if you use the optional [n] parameter to break out to the the outer loop, the result is different. Try replacing the continue statement like this (to get you to the outer level):
In Home mode, the result is as expected, bypassing the inner loop:
But in CAS mode, this CONTINUE statement is totally ignored, giving this output:
This applies both to BREAK and CONTINUE, so I am suspecting a CAS bug.
Just to clarify, when using BREAK 2 instead of CONTINUE 2, in Home mode you will get:
In CAS mode you will get:
I am running Build 2.1.14181.
Maybe I am overlooking something, but I would really like to know.
Regards,
Dag
When using the break or continue statements in both Home and CAS modes, nested loops will show the same effect, e.g. when you use this in home mode:
Code:
export TestContHome()
begin
local a, b;
for a from 1 to 3 do
for b from 1 to 3 do
if even(b) then CONTINUE; end;
print("a="+a+","+"b="+b);
end;
end;
end;
Or, the same in CAS mode:
Code:
#cas
TestContCAS():=
begin
local a, b;
for a from 1 to 3 do
for b from 1 to 3 do
if even(b) then CONTINUE; end;
print("a="+a+","+"b="+b);
end;
end;
end;
#end
You will get the same result:
Code:
a=1,b=1
a=1,b=3
a=2,b=1
a=2,b=3
a=3,b=1
a=3,b=3
But if you use the optional [n] parameter to break out to the the outer loop, the result is different. Try replacing the continue statement like this (to get you to the outer level):
Code:
if even(b) then CONTINUE 2; end;
In Home mode, the result is as expected, bypassing the inner loop:
Code:
a=1,b=1
a=2,b=1
a=3,b=1
But in CAS mode, this CONTINUE statement is totally ignored, giving this output:
Code:
a=1,b=1
a=1,b=2
a=1,b=3
a=2,b=1
a=2,b=2
a=2,b=3
a=3,b=1
a=3,b=2
a=3,b=3
This applies both to BREAK and CONTINUE, so I am suspecting a CAS bug.
Just to clarify, when using BREAK 2 instead of CONTINUE 2, in Home mode you will get:
Code:
a=1,b=1
Code:
a=1,b=1
a=2,b=1
a=3,b=1
I am running Build 2.1.14181.
Maybe I am overlooking something, but I would really like to know.
Regards,
Dag