I got spanked big time for writing code like that. I was going to take it out the I rememberd bullet 3 on "Real Programmers Don't Eat Quiche".
"Don't comment their code. If it was hard to write, it should be hard to understand and even harder to modify."
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Wednesday, January 07, 2009 8:19 AM
To: RPG programming on the IBM i / System i
Subject: RE: Niftiest thing(s) you have done in RPG ILE or /FREE
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
Envoyé : mercredi 7 janvier 2009 14:03
À : 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.