To ask Edu how he is doing in Swift, you can declare a function that takes in Edu's name as a parameter and outputs a message to the console. Here's some sample code that demonstrates this:
main.swift244 chars11 linesIn this code, we declare a function called askHowEduIsDoing that takes in an optional string parameter name. We then use optional binding to unwrap the name parameter and assign it to the constant eduName. If name is nil, we output an error message to the console.
Assuming we provide Eduardo as the name parameter, this code will output the following message to the console:
main.swift41 chars2 lines
gistlibby LogSnag