In the end this is not necessarily a feature of a language, at least how I
see it. If you look at it, the code is basically an IF statement with the
result being passed to a variable vs. being evaluated by the IF construct.
Is that a correct way to view it?
Aaron Bartell
http://mowyourlawn.com
Michael_Schutte@xxxxxxxxxxxx wrote:
<snip>But now I do it all the time. I've never once thought that it might
irritate my colleagues. Is this kind of syntax custIsVld = (custNbr > 0);
used in other languages? What happens if custIsVld is already *on?</snip>
Yes it's used in other languages. Can even get more complicated than that
using switches.
Doesn't matter what the value of it is. It will get re-evaluated and set to
the new condition.
Michael Schutte
Admin Professional
Bob Evans NEW! Chicken Fried Chicken Deep-Dish Dinner: Taking Homestyle to
New Heights! Try all three Deep-Dish Dinners, starting at $5.99. For more
information, visit:
http://www.BobEvans.com/DeepDishDinners
rpg400-l-bounces@xxxxxxxxxxxx wrote on 01/07/2009 08:19:15 AM:
Hi Aaron,
My first thought was WAOOUWW! I must do that.
But then I realised that anyone else in our shop reading that would
not understand.
Instead of Short way, maybe you should call it the lazy way.
I also had a mental block at first with this :
/FREE
i += 1;
/END-FREE
Instead of
/FREE
i = i + 1;
/END-FREE
But now I do it all the time. I've never once thought that it might
irritate my colleagues. Is this kind of syntax custIsVld = (custNbr
0); used in other languages? What happens if custIsVld is already *on?
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] De la part de Aaron Bartell
Envoye : mercredi 7 janvier 2009 14:03
A : RPG programming on the IBM i / System i
Objet : Re: Niftiest thing(s) you have done in RPG ILE or /FREE
I wonder if you changed the question to be more pointed towards
certain concepts if you would get more responses. For example, if
you asked "what are some cool things you can do in one line of code"
then I would think back to something I learned early on that some
programmers still don't know you can do:
Long way...
D custIsVld s n
D custNbr s 10 0
/free
if custNbr > 0;
custIsVld = *on;
else;
custIsVld = *off;
endif;
/end-free
Short way...
D custIsVld s n
D custNbr s 10 0
/free
custIsVld = (custNbr > 0);
/end-free
Every time I get involved with a project with another
developer/customer I learn a bunch of tidbits that make my code
better, compiling easier, or best practices better. The people on
this list could write a book on all those cool things, but its all
in how to ask the question.
Does the above qualify as at least a smaller nifty thing? :-)
Aaron Bartell
http://mowyourlawn.com
Adam West wrote:
I haven't seen too much as yet.
--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http:
//archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.