5 ms·
I'm curious about something. Why this: if shipping-method <> 'FX' move normal-ship-date-yyyymmdd to expected-shipping-date else move nextday-sh
by shedside 9y ago
I'm curious about something. Why this:
if shipping-method <> 'FX'
move normal-ship-date-yyyymmdd to expected-shipping-date
else
move nextday-ship-date-yyyymmdd to expected-shipping-date.
And not the following?
if shipping-method = 'FX'
move nextday-ship-date-yyyymmdd to expected-shipping-date
else
move normal-ship-date-yyyymmdd to expected-shipping-date.
The latter seems clearer to me, and the line below (regarding the cust-type variable) suggests the syntax would be okay. It would also have the advantage of avoiding the column-length issue described in the post. What am I missing here?
- HelloNurse 9y agoProbably taste: normal case first, special case last, regardless of what the respective comparison clauses look like.
- camiller 9y agoAlso efficiency, you want the most often true thing first. Although it is more important in nested if's. Had a colleague write a If else nested 104 levels deep (pre COBOL II so no case structure available). We halved the run time of the program simply by making the four most common conditions the first four.
- waltman 9y agoI'm the author of the article, and to be honest the only reason I did it this way was to make sure the period ended up in column 73. I've presented this in talks about half a dozen times now, and you're the first person ever to notice that. Congrats!