Swift Program to print information of a person using structures
Program
struct Person {
let firstName: String
let lastName: String
}
var firstPerson = Person(firstName: "Gutsy", lastName: "Gibbon")
print("Name of the first person: \(firstPerson.firstName) \(firstPerson.lastName)")
var secondPerson = Person(firstName: "Utopic", lastName: "Unicorn")
print("Name of the second person: \(secondPerson.firstName) \(secondPerson.lastName)")
Output
$ swift struct_person.swift
Name of the first person: Gutsy Gibbon
Name of the second person: Utopic Unicorn