There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
I don’t think there is anything wrong with Codecademy’s statement (though I could be wrong). If we look at the documentation linked to by Codecademy for argument labels (https://docs.swift.org/swift-book/LanguageGuide/Functions.html#ID166), the documentation itself uses the term “argument labels”. “Parameters” are “argument labels” are not the same thing. In this particular exercise, it seems Codecademy has used the appropriate term.
The print function has optional parameters. If we omit these parameters, their default values are used. The default value of the terminator parameter is a newline i.e. “\n”
You can override the default by specifying the character(s) you want. print(num, terminator: " ") will give the output 3 2 1 print(num, terminator: "") will give the output 321
You can also provide a value for another optional parameter called the separator (whose default value is a single space " ").
For example, print("abc", "def", "ghi", separator: "...", terminator: "!!!") will print: abc...def...ghi!!!
@mtrtmk Thank you!! I understand it much better now. I will also keep the separator in mind for the future and play around with both a bit. Again, thanks!
Hey all! I have a question about the contents in the “Loops: The stride() Function” lesson…
In the example:
The argument label “to: 6” is specified in the stride function. In the output, 6 is not included. In the lesson description it says, " * The second argument, to: 6 is the end of the sequence (6). But notice, we didn’t print out 6which means this end number is not included."
I want to clarify this a bit further. Does this output mean that:
Generally the item in the to: argument (the sequence end) is never included in the stride() function output?
Or, is it that in this example 6 is not actually in the array that is being looped?