Control Flow

Case When

Match values and ranges with case and when.

Reference View source
Source control_flow/case_when.vibe
def label(score)
  case score
  when 100
    "perfect"
  when 90, 95
    "great"
  else
    "ok"
  end
end

def run
  [label(100), label(95), label(70)]
end
Output
Press Run example to run this code.