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, 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'
else. NB. should be elseif. do.
   echo 'other'
end.
)

    iftest 1
one
other
    iftest 2
two
other
    iftest 3
three
    iftest 4
other

Wouldn't it be possible to have that working like expected? Or elseif do
flag an error?

Greetings,
Ben
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to