Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread 'Mike Day' via Programming
'several pages of "if x = 1..." through "if x = 77..." statements. ' ... that seems typical of COBOL code that I happened upon. "The more verbose the better" was its apparent motto. M On 11/12/2019 17:10, 'Jim Russell' via Programming wrote: Thanks, and of course. Mine was a knee jerk reacti

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread 'Jim Russell' via Programming
Thanks, and of course. Mine was a knee jerk reaction to some COBOL code long ago from a young programmer who, having not yet mastered the intricacies of a "go to depending on" clause, instead had several pages of "if x = 1..." through "if x = 77..." statements. > On Dec 11, 2019, at 11:09 AM,

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread Raul Miller
https://www.jsoftware.com/help/dictionary/csel.htm But, also, https://www.jsoftware.com/help/dictionary/d520.htm and https://www.jsoftware.com/help/dictionary/d621.htm But it's usually not wise to make efficiency claims which are not supported by benchmarks. And, benchmarks tend to be specific t

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread Henry Rich
select. in J is equivalent to a series of tests.  In fact there is some extra overhead, so it is used for explanatory value, not for performance.  It's nothing like a computed GOTO. Henry Rich On 12/11/2019 11:03 AM, 'Jim Russell' via Programming wrote: Yes but... I'd contend that a string of

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread 'Jim Russell' via Programming
Yes but... I'd contend that a string of tests is usually less efficient than (perhaps calculating) some numeric value that is amenable to a case statement. ( I should have checked first; J does have a case statement, does it not?) > On Dec 11, 2019, at 10:32 AM, Henry Rich wrote: > > Yes. >

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread Henry Rich
Yes. Henry Rich On 12/11/2019 5:46 AM, 'Mike Day' via Programming wrote: So is it still ok in J9 - and will it be ok - to continue using the following paradigm? if. T  do. B elseif. T1 do. B1 elseif. T2 do. B2 end. Thanks, Mike On 11/12/2019 10:23, Henry Rich wrote: else. after elsei

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread 'Mike Day' via Programming
So is it still ok in J9 - and will it be ok - to continue using the following paradigm? if. T  do. B elseif. T1 do. B1 elseif. T2 do. B2 end. Thanks, Mike On 11/12/2019 10:23, Henry Rich wrote: else. after elseif. is new in 9.01, and you found a bug in it. JfC is for J6.02. Henry Rich

Re: [Jprogramming] if. do. elseif. else. end.

2019-12-11 Thread Henry Rich
else. after elseif. is new in 9.01, and you found a bug in it. JfC is for J6.02. Henry Rich On 12/10/2019 8:23 PM, Ben Gorte wrote: Hi, Despite repeated warnings in JforC I stepped into the trap of using elseif. and else. in the same if.-statement. It took some effort to find that error, beca

[Jprogramming] if. do. elseif. else. end.

2019-12-10 Thread Ben Gorte
Hi, Despite repeated warnings in JforC I stepped into the trap of using elseif. and else. in the same if.-statement. It took some effort to find that error, because the behaviour is kind of weird: iftest =: 3 : 0 if. y=1 do. echo 'one' elseif. y=2 do. echo 'two' elseif. y=3 do. echo 'three