Swift Flashcards

0
Q

Swift: how do you declare a constant?

A

Let variable = value.

Like python, the interpreter will determine the variable type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Swift: how do you create a variable?

A
var variable (inferred)
var variable: Int
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Swift: give an example of an if statement

A
if true 
{
}
Else
{
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Swift: declare a class with a constructor

A
class MyClass
{
   let constval=3
   var variable: Int
   init (first: Int, second: String)
   {
       Code
   }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly