Search Header Logo
Lesson Variables

Lesson Variables

Assessment

Presentation

Computers

9th Grade

Practice Problem

Medium

Used 19+ times

FREE Resource

7 Slides • 8 Questions

1

variables
Swiftplayground
Week 2

media

Computer Science - CSC400

2

Objectives

  • Define variables as a value that can change, depending on conditions or on information passed to the program under the Swift programming platform.

  • Identify different types of variables used to store data in Swift programming platform and the way to parse data between them.

  • Declare a variable and assign a value to it using the Swift programming platform syntax to hold a specific data within a program

3

Objectives

  • Declare Constants using let command in Swift Programming platform to hold a non-changing variable value.

  • Use the assignment operator (=) to assign a new value to a variable in a program that matches its defined data type

  • Identify the scope of the local variables in a programming as an indication of how accessible a variable is to a function or another call within the same program.

  • Perform arithmetic, increment, decrement, comparison between variables and logical operators to perform different operations on variables

4

Define variable

Variable : A named container that stores a value. The value can change over time.

5

Multiple Choice

Which of the following is the correct definition of a variable?

1

A function that performs calculations

2

A storage location in memory with a specific name

3

A type of loop that repeats actions

4

A collection of data items

6

Types of variable

let name = "Ahmad". // String
var age = 15 // Integer
var height = 1.6 // float
var isOnClosedSwitch = true //Boolean

7

Multiple Choice

Which of the following types is a String?

1

let name = "Sara"

2

var age = 15

3

let speed = 80.5

4

var isBlocked = false

8

Multiple Choice

Which of the following types is a float?

1

let name = "Sara"

2

var age = 15

3

let speed = 80.5

4

var isBlocked = false

9

Multiple Choice

Which of the following types is a boolean?

1

let name = "Sara"

2

var age = 15

3

let speed = 80.5

4

var isBlocked = false

10

Multiple Choice

Which of the following types is an integer?

1

let name = "Sara"

2

var age = 15

3

let speed = 80.5

4

var isBlocked = false

11

Declare a constant

Constant: A named Container that stores a value that can't be changed
example:
let name = "Amna"
Variable : a variable that can be modified later
example :
var EnglishMark = 90

12

Multiple Choice

In Swift programming, what keyword is used to declare a variable that can be modified later?

1

const

2

var

3

let

4

mut

13

Multiple Choice

How do you declare a constant in Swift?

1

constant myValue = 10

2

static myValue = 10

3

let myValue = 10

4

final myValue = 10

14

Swift playground

Solve Swift playground :
Keeping Track
Bump up the Value
Incrementing the Value

15

Open Ended

Search on the internet and write what are the rules of Naming variable?

variables
Swiftplayground
Week 2

media

Computer Science - CSC400

Show answer

Auto Play

Slide 1 / 15

SLIDE