aboutsummaryrefslogtreecommitdiff
path: root/aoc-2020-gleam/src/ext/boolx.gleam
blob: f3c8b49e1eafba604ceeca1999c86faf4c6afe82 (plain)
1
2
3
4
5
6
7
8
9
10
pub fn guard_lazy(
  when requirement: Bool,
  return consequence: fn() -> t,
  otherwise alternative: fn() -> t,
) -> t {
  case requirement {
    True -> consequence()
    False -> alternative()
  }
}