Requesting ELSEIF
|
03-24-2017, 05:30 PM
Post: #1
|
|||
|
|||
Requesting ELSEIF
If you're taking suggestions for additions to HPPL, I'd like to propose the addition of ELSEIF (or ELIF). With lengthy IF-THEN structures, it can tighten up the code considerably.
Tom L Current way (greatly trivialized example): Code: IF x>7 THEN Now improved with ELSEIF Code: IF x>7 THEN Tom L Cui bono? |
|||
03-24-2017, 05:38 PM
Post: #2
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 05:30 PM)toml_12953 Wrote: CASE blocks have similar logic to nested ELSE-IF blocks (exiting the block once a condition is met and relevant actions are executed). It doesn't make your code any shorter but can provide improved legibility. Code: CASE Graph 3D | QPI | SolveSys |
|||
03-24-2017, 06:21 PM
(This post was last modified: 03-24-2017 07:17 PM by compsystems.)
Post: #3
|
|||
|
|||
RE: Requesting ELSEIF
I like the version ELSEIF. instead of using CASE
now with IFTE functional command version PHP Code: EXPORT elif(x) A small survey. you need an IFT() functional command? (without ELSE block) PHP Code: EXPORT ift(x) |
|||
03-24-2017, 06:52 PM
Post: #4
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 06:21 PM)compsystems Wrote: I like the version ELSEIF. instead of using CASE I'm all for anything that makes my job easier. I actually make a living converting old programs (mostly BASIC) to run on Prime. I'd share them with the group but my employer owns everything I write relating to their business (even after hours!) I'd like both ELSEIF and IFTE. I'd also like user-defined datatypes (like records), printing and a whole bunch more. We can dream, can't we? Tom L Tom L Cui bono? |
|||
03-24-2017, 07:16 PM
Post: #5
|
|||
|
|||
RE: Requesting ELSEIF
What kind toml_12953 of programs are you converting and where can you test them?
|
|||
03-24-2017, 07:33 PM
Post: #6
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 07:16 PM)compsystems Wrote: What kind toml_12953 of programs are you converting and where can you test them? I convert environmental programs. These were used for by our field workers for years on laptops and even some BASIC handhelds. We're equipping them with Primes now and I convert programs that monitor and analyze climate data (yes it really IS changing!) and do things like calculate how fast the liquid level in different shaped tanks such as underground tanks used by abandoned gas stations will go up or down based on the input or leakage (a lot of differential equations there). We also keep track of changing migratory patterns of birds and other animals. It's a lot of fun at times but sometimes converting the spaghetti code makes me want to hit the sauce! Gee, C, Pascal and other languages have GOTO. Why can't Prime? Tom L Tom L Cui bono? |
|||
03-24-2017, 07:45 PM
Post: #7
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 06:21 PM)compsystems Wrote: you need an IFT() functional command? (without ELSE block) IFTE can be defined without ELSE Viga C | TD | FB |
|||
03-24-2017, 08:16 PM
Post: #8
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 07:45 PM)Carlos295pz Wrote:(03-24-2017 06:21 PM)compsystems Wrote: you need an IFT() functional command? (without ELSE block) but only HOME PRG, for CAS fails PHP Code: EXPORT iftHOME(x) iftHOME(8); returns "Done" iftCAS(8); returns "when(x>7,print(""true"")) in iftCAS(5) instruction #1 error, try debug(iftCAS(5)) Error: Bad Argument Type" |
|||
03-25-2017, 11:43 AM
Post: #9
|
|||
|
|||
RE: Requesting ELSEIF
(03-24-2017 05:38 PM)Han Wrote: CASE blocks have similar logic to nested ELSE-IF blocks (exiting the block once a condition is met and relevant actions are executed). It doesn't make your code any shorter but can provide improved legibility. Just to show you, here's the actual ANSI/ISO BASIC statement statement I'm converting: PHP Code: IF (t = 1) OR (t = 2) OR (t = 3) THEN Tom L Cui bono? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)