HP Forums
Switch statement on cas mode - 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: Switch statement on cas mode (/thread-15675.html)



Switch statement on cas mode - fakuivan - 10-03-2020 01:34 AM

Does anyone have an idea of how to compose switch statements on CAS programs? There's this from the giac documentation, but it does not seem to work since the brackets syntax for blocks is not a thing on the prime version.


RE: Switch statement on cas mode - toml_12953 - 10-03-2020 01:44 AM

(10-03-2020 01:34 AM)fakuivan Wrote:  Does anyone have an idea of how to compose switch statements on CAS programs? There's this from the giac documentation, but it does not seem to work since the brackets syntax for blocks is not a thing on the prime version.
Since SWITCH isn't even in the catalog, I use a string of

IF
...
ELSEIF
...
ELSEIF
...
ELSE
...
END

statements


RE: Switch statement on cas mode - fakuivan - 10-03-2020 05:02 AM

switch, case and default are reserved words on CAS (try to assign a value to them). There are many functions that are not in the catalogue but are still accessible. I'm hoping here someone with the code for the calculator in hand can tell me if it's possible to get it working. I'm aware of the alternatives like early returns or concatenated if statements.