12 lines
565 B
BQN
12 lines
565 B
BQN
If ← {𝕏⍟𝕎@}´ # Also Repeat
|
||
IfElse ← {c‿T‿F: c◶F‿T@}
|
||
While ← {𝕩{𝔽⍟𝔾∘𝔽_𝕣_𝔾∘𝔽⍟𝔾𝕩}𝕨@}´ # While 1‿{... to run forever
|
||
DoWhile ← {𝕏@ ⋄ While 𝕨‿𝕩}´
|
||
For ← {I‿C‿P‿A: I@ ⋄ While⟨C,P∘A⟩}
|
||
|
||
# Switch/case statements have many variations; these are a few
|
||
Match ← {𝕏𝕨}´
|
||
Select ← {(⊑𝕩)◶(1↓𝕩)@}
|
||
Switch ← {c←⊑𝕩 ⋄ m‿a←<˘⍉∘‿2⥊1↓𝕩 ⋄ (⊑a⊐C)◶m@}
|
||
Test ← {fn←{C‿A𝕊e:C◶A‿E}´𝕩⋄Fn@}
|