Swift Flashcards
0
Q
Swift: how do you declare a constant?
A
Let variable = value.
Like python, the interpreter will determine the variable type.
1
Q
Swift: what is a playground?
A
A playground is an on-the-fly command interpreter for swift, similar to the python command line.
2
Q
Swift: how do you create a variable?
A
var variable (inferred) var variable: Int
3
Q
Swift: give an example of an if statement
A
if true { } Else { }
4
Q
Swift: declare a class with a constructor
A
class MyClass { let constval=3 var variable: Int
init (first: Int, second: String) { Code } }