0
0
iOS Swiftmobile~10 mins

Data types (Int, Double, String, Bool) in iOS Swift - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an integer variable named count with value 10.

iOS Swift
var count: [1] = 10
Drag options to blanks, or click blank then click option'
AInt
BBool
CString
DDouble
Attempts:
3 left
💡 Hint
Common Mistakes
Using Double instead of Int for whole numbers.
Using String when a number is needed.
2fill in blank
medium

Complete the code to declare a variable price with a decimal value 9.99.

iOS Swift
var price: [1] = 9.99
Drag options to blanks, or click blank then click option'
ADouble
BBool
CInt
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int for decimal numbers causes errors.
Using Bool or String instead of a number type.
3fill in blank
hard

Fix the error in the code by choosing the correct type for the variable isActive.

iOS Swift
var isActive: [1] = true
Drag options to blanks, or click blank then click option'
AInt
BBool
CDouble
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using String or Int for boolean values.
Using Double instead of Bool.
4fill in blank
hard

Fill both blanks to declare a variable greeting with a text value.

iOS Swift
var greeting: [1] = [2]
Drag options to blanks, or click blank then click option'
AString
B"Hello"
CBool
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around text values.
Using Bool or Int types for text.
5fill in blank
hard

Fill all three blanks to declare a variable temperature with a decimal value and print it.

iOS Swift
var [1]: [2] = [3]
print(temperature)
Drag options to blanks, or click blank then click option'
Atemperature
BDouble
C36.6
DInt
Attempts:
3 left
💡 Hint
Common Mistakes
Using Int instead of Double for decimal values.
Using wrong variable name.