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

pub type SchoolPerson {
  Teacher(name: String, subject: String, floor: Int, room: Int)
}

pub fn main() {
  let teacher1 = Teacher(name: "Mr Dodd", subject: "ICT", floor: 2, room: 2)

  // Use the update syntax
  let teacher2 = Teacher(..teacher1, subject: "PE", room: 6)

  io.debug(teacher1)
  io.debug(teacher2)
}