HP Forums
arg() crashes the emulator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: arg() crashes the emulator (/thread-3151.html)

Pages: 1 2


RE: arg() crashes the emulator - Angus - 02-25-2015 04:25 PM

Good You Pointed that out! Totally my fault I was mislead by the exact. Problem solved. Thanks


RE: arg() crashes the emulator - salvomic - 02-25-2015 07:01 PM

(02-25-2015 02:54 PM)Han Wrote:  Based on what I can observe, both return and RETURN are used to return a value; however, RETURN will also exit the current function/procedure whereas return does not. As for return 0 vs. return(0), I believe this is the same.
...

Now I understand because a program of mine didn't work: with return it didn't exit...

Thank you, Han.

I'll amend it with uppercase.


RE: arg() crashes the emulator - salvomic - 02-25-2015 07:22 PM

(02-25-2015 02:54 PM)Han Wrote:  
Code:
#cas
RETEXAMPLE():=
BEGIN
  IF 1>0 THEN
    return("Yes!");
  END;
  return("Reached end of program");
END;
#end

Also:
Code:

#cas
RETEXAMPLE():=
BEGIN
  IF 1>0 THEN
    return rr:=12;
  END;
  return(rr-2);
END;
#end

end with 10
but
Code:

#cas
RETEXAMPLE():=
BEGIN
  IF 1>0 THEN
    RETURN rr:=12;
  END;
  return(rr-2);
END;
#end
exit with 12...

So, return (lowercase) pass a value to the rest of the program, isn't it?