85% of iOS developers got the wrong answer 🫢
Hi 👋
In France May the 1st is a national holiday, that’s why you’re exceptionally receiving my weekly email on this Tuesday morning!
On my end I used some of this extra free-time to upgrade my YouTube setup with a super cool TV that adds a nice warm and welcoming touch!
I’m really happy with how it looks on camera and I’m so excited to start recording my next videos in this upgraded setup 🤩
I guess you’ve realized by now that I really like making quizzes about weird pieces of Swift trivia!
Here’s the last one I’ve asked on social media:
I asked people what they thought the result was, amongst these 4 potential answers:
“a = 10”
“a = Optional(10)”
“a = nil”
“it will crash 💥”
Now before I give you the solution, please take a few seconds to come up with your own answer!
(and pay close attention to the code example: every single character in it is significant)
👇
👇
👇
👇
👇
👇
👇
👇
Alright, it’s time for the answer:
As you can see, just above 15% out of the 695 iOS developers that answered got the correct result!
And this is by no means surprising: this question was about a very obscure piece of Swift syntax called Conditional Assignment.
To be honest, I don’t think I’ve ever needed to use this syntax myself!
Here’s how Conditional Assignment works: it allows an assignment to happen only when the optional variable that’s being assigned already contains a non-nil value 🤓
Now that you also know about this obscure syntax, you can ask my quiz question to your own colleagues and see if they can figure it out!
But promise me that you won’t be asking this question in technical interviews, it’s really not a good way to evaluate a candidate!
That’s all for this email, thanks for reading it!
If you’ve enjoyed it, feel free to forward it
to your friends and colleagues 🙌
I wish you an amazing week!
❤️