select.

select. 控制結構 is used in 明確 定義 (:).

select. T
 case.  T0 do. B0
 case.  T1 do. B1
 fcase. T2 do. B2
 case.  T3 do. B3
end.
result R of T is compared to 分子 of result Ri of Ti ,與 Bi block of first case. or fcase. with a match is evaluated. Evaluation of select. 控制結構 n terminates for a case. , or continues with 下個 B(i+1) block for an fcase. (and furr continues if it is an fcase.).

比較 is R e.&boxif開啟Ri where boxif開啟=:<^:(L.=0:) ,與a case with an omitted Ti is considered to match.
 

例如:
f0=: 3 : 0
 select. y.
  case. 1;2 do. 'one two'
  case. 3   do. 'three'
  case. 4;5 do. 'four five'
  case. 6   do. 666
 end.
)

   f0&.> 1 2 3 4 5 6
+-------+-------+-----+---------+---------+---+
|one two|one two|three|four five|four five|666|
+-------+-------+-----+---------+---------+---+

   (i.0 0) -: f0 7
1

f1=: 3 : 0
 select. y.
  case. 'a' do. i.1
  case. 'b' do. i.2
  case.     do. i.3
 end.
)

   f1&.> 'a' ; ('a';'b') ; 'b' ; 'x'
+-+-+---+-----+
|0|0|0 1|0 1 2|
+-+-+---+-----+

f2=: 3 : 0
 t=. ''
 select. y.
  case.  1 do. t=.t,'one '
  fcase. 2 do. t=.t,'two '
  case.  3 do. t=.t,'three '
  fcase. 4 do. t=.t,'four '
 end.
)

   f2 1
one 

   f2 2
two three 

   f2 3
three 

   f2 4
four 

   '' -: f2 5
1

下個前個字彙索引主選單