Beginning Swift 3 - Part 4: Strings | Ray Wenderlich

Learn about strings in Swift 3.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4095-beginning-swift-3/lessons/4

The second solution you provide - while giving the right answer is not what your are looking for from the student. You asked the students to add the ā€œfirstNameā€ and ā€œlastNameā€ constants.

Your solution is : let fullName = ā€œBrianā€ + " " + ā€œMoakleyā€

In the solution provided added string literals - not the previously defined constants

The solution should be: let fullName = firstName + " " + lastName

nit: At 2:23 the interpolated string is presented as

Hello my name is Brian

correction:

Hello my name is Brian!

(exclamation mark missing).

At 5:33, the escape character ā€˜\nā€™ is referred to as a ā€˜carriage returnā€™, when itā€™s actually known a ā€˜line feedā€™. The escape character for ā€˜carriage returnā€™ is ā€˜\rā€™.[1]

[1]Strings and Characters ā€” The Swift Programming Language (Swift 5.7)