0

What is the answer to functions and closures question 2

What is the answer to functions and closures question 2, I can't work it out

11th Feb 2017, 10:25 PM
Pierce
1 Odpowiedź
+ 1
____ sq(num: Int) __ Int { ______ num*num } print(sq(2)) This one? When you declare a function in swift you use the func keyword before the functions name. To define the return type you use the arrow -> after the parentheses and before the type to be returned. Use the keyword return in order to specify the value that is to be returned. func -> return. When you don't know the answer to the question in the quizzes, just go back to the previous screen and review the material until you understand. Understanding the concepts and syntax etc is more important than getting the answer correct. The more you do it the better you should get at it.
11th Feb 2017, 10:53 PM
ChaoticDawg
ChaoticDawg - avatar