Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 761 Bytes

README.md

File metadata and controls

11 lines (6 loc) · 761 Bytes

Optionals

https://www.hackingwithswift.com/100/swiftui/14

Checkpoint 9

Your challenge is this: write a function that accepts an optional array of integers, and returns one randomly. If the array is missing or empty, return a random number in the range 1 through 100.

If that sounds easy, it’s because I haven’t explained the catch yet: I want you to write your function in a single line of code. No, that doesn’t mean you should just write lots of code then remove all the line breaks – you should be able to write this whole thing in one line of code.

https://www.hackingwithswift.com/quick-start/beginners/checkpoint-9