Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Latest commit

 

History

History
19 lines (13 loc) · 581 Bytes

case.md

File metadata and controls

19 lines (13 loc) · 581 Bytes

case

case implements the common switch/case pattern: The function expects an even number of expressions and will sequentially process them in pairs. If the first expression yields true, case will return the second expression. Otherwise the next pair is checked. If none of the pairs match, case returns null.

Examples

  • (case true 1 false) ➜ invalid
  • (case true 1 false 2)1
  • (case false 1 true 2)2
  • (case false 1 (eq? 1 2) 2)null

Forms

(case exprs:expression…)any

  • exprs is an even number of expressions.