I am trying to run this procedure, but am getting an "Error, missing operation", highlighting the conditional break:
is_prime := proc()
local i, x_check;
printf(`Enter an integer to check if it is a prime number...`);
x_check:=parse(readline(terminal));
if x_check<=2 then
printf(cat(x_check,` is a prime number.`));
else
for i from 2 to x_check-1 do
if (irem(x_check,i)=0) then
printf(cat(x_check,` is not a prime number.`));
break 2;
end if;
end do;
printf(cat(x_check,` is a prime number.`));
end if;
end proc:
If I don't include the integer, I am able to run the procedure, but it does not function like I would like it to. I am running Maple 2022, and can sucessfully run the example conditional break code in the Help. What is wrong with my use of break?