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

Reply via email to