Variables Flashcards

1
Q

How do you declare a Variable?

A

With the var-Keyword

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

If you are clear about the kind of values the constant or variable can store, how do you provide a type annotation when you declare a variable?

A

Write a type annotation by placing a colon after the constant or variable name, followed by a space, followed by the name of the type to use.

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

What represents whole Numbers and what is the keyword?

A

Integer - Int

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

Which two Types represent floating-Numbers in Swift?

What is their keyword and Difference?

A
  1. Double - Double - Represents a 64-bit floating-point number.
  2. Float - Float - Represents a 32-bit floating-point number.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you convert variables in different Types?

A

“Type”

eg.

Int(number)

Float(number)

Double(number)

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

How do you concatenate a string with an variable?

A

” string…. (nameOfVaribale)”

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