aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter5_advanced_features/lesson03_panic/code.gleam
blob: fce9d66040bd09308a87c9ce5a966d6fd8f231a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gleam/io

pub fn main() {
  print_score(10)
  print_score(100_000)
  print_score(-1)
}

pub fn print_score(score: Int) {
  case score {
    score if score > 1000 -> io.println("High score!")
    score if score > 0 -> io.println("Still working on it")
    _ -> panic as "Scores should never be negative!"
  }
}