× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jon Paris wrote:
In languages where ELSEIF is not supported ELSE followed by IF will be. Not as elegant but ...
My problem with the ELSEIF is just what you state. In C-based languages you can get away with ELSE IF because of punctuation. Languages with a closing ENDIF must have a separate ELSEIF to allow the same syntax.

So, if you use ELSE IF in C, for example, you only close the last ELSE (it's tricky, but it works, and I hate tricky), whereas if you use ELSE IF in RPG you must close it with as many ENDIFs as you have IFs. So you have to use the ELSEIF opcode.


I guess we are all somewhat enslaved by our own particular mental models.
The trick is to progress beyond them, Jon. For example, I grew up with switch/case. But today I use the better tool - I use SELECT for multiple branching conditions and IF to test a single condition. SELECT signals clearly that there are multiple conditions to be processed, whereas IF signals a single branch point. That's my new mental model, made possible by RPG.

In C-based languages for program flow I have to choose between switch and elseif. Switch is horrible and elseif forces me to use the same basic syntax for two different things. I prefer RPG's flexibility.

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.