Variables
#variables
Overview
Whenever possible, always prefer constants over variables. In this way, Apple will stop you from an error.
Variables
int = 1
double = 3.14
string = "Hello"
bool = True / False
Sample parts of the code
var => type
greeting => variable name
= => assign
"" => variable value. Since it has " marks on both sides, it is String
private var & private (set)
To give access to outside of the struct you should initialize it (init).
Example from HWS
Even if one of the properties is private and did not call from outside of the struct, you should initialize it.
Wrong Code
Right code
Videos
Sources
Sources
Videos
Articles / Documents
Last updated