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