aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
blob: aaa2208389acf862788b12a8dac6dfd84a6d280c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gleam/io
import gleam/int

pub fn main() {
  let x = int.random(5)
  io.debug(x)

  let result = case x {
    // Match specific values
    0 -> "Zero"
    1 -> "One"

    // Match any other value
    _ -> "Other"
  }
  io.debug(result)
}