Skip to content

Instantly share code, notes, and snippets.

@Gabbrolee
Created August 3, 2021 16:06
Show Gist options
  • Save Gabbrolee/396abb1aaa9ce2d814b3216ad310498e to your computer and use it in GitHub Desktop.
Save Gabbrolee/396abb1aaa9ce2d814b3216ad310498e to your computer and use it in GitHub Desktop.
VARIABLES AND CONSTANT
import UIKit
//MARKS:- VARIABLES AND CONSTANTS
/* variables are data stored that can have their value change whenever we want it and constant are value that can not be changed .. advaantage of using var in declaring a variable and let in declaring a constant is that it help xcode to remind us of the constant we have set and whenever we try to change it, it will not xcode will not compile our code and it help to save memory space that is optimization of memory. */
// create a name variable
var name = " James Bond"
// name can be updated without xcode throwing error message and there is no need to redeclare it anymore
name = "Ade Osun"
// print what is in the name variable
print("\(name)") // Ade Osun is printed instead of James Bond and it is //as a result of the variable name been updated
// let's create variable with let and try to change it
let address = " 17, James Bond Street"
// address has been alter and xcode will not run this code
address = "8, Ade Osun Street"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment