Structure Creation

struct Building {
  var address: String
  var floors: Int
  init(address: String, floors: Int) {
    self.address = address
    self. floors = floors
  }
}

Structs or structs are used to programmatically represent real-life objects in code. A structure is created using the struct keyword, followed by its name, followed by a body containing its properties and methods

Comments