Swift Tour contains an experiment wherein one must call a function that returns only odd numbers.

The solution requires code that appears to me to not have been covered previously in the lessons. I think up until now all of the solutions were attainable with the material I have been presented before hand, But I’m not sure how to go about doing this at the moment.

What is your question ? What do you expect ?

Accepted Answer

Within the 'The Swift Programming Language" iBook, the Language Guide can be used alongside The Tour, if more detailed explanations are required. The 'Basic Operator' section of the Language Guide defines the remainder operator, "%", which, in conjuction with the ".map" method, enables location of the odd-numbered values within the array. Any integer, when divided by 2, produces a remainder of either 0 or 1. Odd integers contain a remainder of 1. Once located, operations can be performed upon the integers, mutating the values within their respective indices in the array.

> appears to me to not have been covered previously in the lessons


There's your problem. Swift Tour is a 'tour', not a lesson. It is introductory reference material meant for information sharing.


Basic Operators are broken out in the Language Guide. . OIherwise, you're off to a good start.


But on that subject, there are lessons where the goal is to step out and discover the larger picture and any missing parts, rather than stay only within the lesson and solve the puzzle with what is solely in front of them. In a world where some skills are taught, and others can only be encouraged, curiosity ranks high among the skills every dev needs - interestingly enough, tho, simply having the gift of curiosity isn't enough...it needs to be unwapped and put to use as well.


If you have questions/suggestions on the efficacy of the materials, however, feel free to file bugs against the docs via the bug reporter link below left, adding your report # to your (closed) thread for reference, thanks and good luck.

Swift Tour contains an experiment wherein one must call a function that returns only odd numbers.
 
 
Q