Unit 2: Naming & Identifiers Flashcards

1
Q

Assignment

A

used to give a name a value when you first declare a name or when you update a variable’s value

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

Constant

A

an identifier that’s immutable

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

Declaration

A

introduces a new name or construct into your program

used to introduce functions, methods, variables, and constants, as well as to define new named types

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

Identifier

A

refers to a value, function, type or any other abstraction

a formal word for a name in code

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

Keyword

A

a term that has a special meaning in Swift and can’t be used for any other purposes

e.g.,

func (keyword) can’t be used in this example:

var func

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

Pet Problem

A

Using Xcode, I can create a playground that details the number of animals available for the show.

E.g.,

//Number Of Dogs 
5
//Number of Cats
4
//Number of Turtles 
3

計算モード

// Total Number of Animals 
5+4+3                                   12
//Total Number of Mammals 
5 + 4                                      9
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Defining a Constant

A

To define a constant, please follow the example below:

Let numberOfDogs = 6
Let numberOfCats = 5
Let numberOfTurtles = 2
Let numberOfHamsters = 1

*After defining a constant and assigning a value to it, you can use the constant wherever you would have used the value, including in mathematical calculations that define the value of a new constant:

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