As Mark W. mentioned, also as in C.

The benefit in RPG, as implied by your "+ LEAVE", is that you can't fall through to subsequent "when..." constructs like you can in C or Java if you forget the "break" statement.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power






-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Buck Calabro
Sent: Friday, January 25, 2019 5:41 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: select vs. if-elseif

On Friday, January 25, 2019, 4:01:55 PM EST, Mark Murphy <
jmarkmurphy@xxxxxxxxx> wrote:

Does anyone else find the redundancy between the select block and the
if-elseif-else block a little disconcerting? Seems to me that there should
be a clear distinction between the two.

I've come to think of the SELECT as an IF + LEAVE, but that weirdness
aside, I agree with you.

on what mood I am in. But the select syntax has a potentially game changing
syntax.

select <variable>;
when <value>;
...
other;
...
endsl;

This is very similar to the SWITCH in Java.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/switch.html

--buck

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].