Optional parameters

func getFirstInitial(from name: String?) -> String? {
  return name?.first
}

Functions can accept optional types and return optional types. When a function cannot return a reasonable instance of the requested type, it should return nil

Comments