aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter1_functions/lesson06_labelled_arguments/code.gleam
blob: 25bb8c1844b6c499a6c8d74b6b090d247ef2a646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gleam/io

pub fn main() {
  // Without using labels
  io.debug(calculate(1, 2, 3))

  // Using the labels
  io.debug(calculate(1, add: 2, multiply: 3))

  // Using the labels in a different order
  io.debug(calculate(1, multiply: 3, add: 2))
}

fn calculate(value: Int, add addend: Int, multiply multiplier: Int) {
  value * multiplier + addend
}