Skip to content

Instantly share code, notes, and snippets.

@nmbr73
Last active September 28, 2022 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmbr73/8cdf52091743ed63feea0fdbea66192c to your computer and use it in GitHub Desktop.
Save nmbr73/8cdf52091743ed63feea0fdbea66192c to your computer and use it in GitHub Desktop.
Day 14, Checkpoint 9 of #100DaysOfSwiftUI ... where @twostraws provided some excellent content again! #HACKINGWITHSWIFT https://www.hackingwithswift.com/quick-start/beginners/checkpoint-9
func f(_ array: [Int]? ) -> Int {
return array?.randomElement() ?? Int.random(in: 1...100)
}
f(nil)
f([Int]())
f([-1,-2,-3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment