|
|
|
|
|
by heydenberk
4386 days ago
|
|
Optional binding in JavaScript is a misfeature, and Ruby's looks that way too, because 99% of the time when you do this: if (hasAccess = true) {
doSomething();
}
you meant to compare, not assign. So when I saw this Ruby example, I was not amused: if current_user = find_current_user
notify_user(current_user)
end
However, the Swift equivalent is the best of both worlds: if let currentUser = findCurrentUser() {
notifyUser(currentUser)
}
|
|