You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the chapter about returning closures from functions, the 2nd example of a "shorthand" way to invoke a closure that is returned from a function reads:
let result2 = travel()("London")
Even though this does work, it not only looks strange but can be misleading, plus, throws a warning in the Playground, and rightfully so, as in this example we're trying to assign the non-existing return value to a constant.
Steps to reproduce
Copy/paste the code into a Playground and see.
Expected behavior
Either use a closure that returns something or don't try to capture the result, like this:
travel()("London")
Actual behavior
Environment
iOS Version: 17.2.1
Unwrap App Version: Latest
Device: iPhone Pro 13
The text was updated successfully, but these errors were encountered:
In the chapter about returning closures from functions, the 2nd example of a "shorthand" way to invoke a closure that is returned from a function reads:
let result2 = travel()("London")
Even though this does work, it not only looks strange but can be misleading, plus, throws a warning in the Playground, and rightfully so, as in this example we're trying to assign the non-existing return value to a constant.
Steps to reproduce
Copy/paste the code into a Playground and see.
Expected behavior
Either use a closure that returns something or don't try to capture the result, like this:
travel()("London")
Actual behavior
Environment
The text was updated successfully, but these errors were encountered: