שאלה:
Determine the value of “x” in the Swift code below.
Explain your answer.
var a1 = [1, 2, 3, 4, 5]
var a2 = a1
a2.append(6)
var x = a1.count
תשובה: X=5
שאלה:
Swift 2.0 features a new keyword to make recursive enumerations. Here is an example of such an enumeration with a Node case that takes two associated value types, T and List:
enum List<T> {
case Node(T, List<T>)
}
What's that keyword?
תשובה:
It's the indirect keyword that allows for recursive enumeration cases like this:
enum List<T> {
indirect case Cons(T, List<T>)
}
הצלחתם לפתור? הגישו מועמדות עכשיו למשרת מפתח סוויפט:
https://jobswipe.co/share/job/552a26ea866bc0f22f4f0590