13
Dec
CLASSES AND OBJECTS
by Maribel
No Comments
//CLASS //To create a new class use the class keyword followed by the class name and a pair of braces. Inside the braces we...
12
Dec
FOR LOOPS – Double Numbers
by Maribel
No Comments
var sampleArray = [8.0, 7.0, 19.0, 28.0] for (index,value) in sampleArray.enumerated(){ sampleArray [index] = value / 2 } print(sampleArray) // ".0" in each...
12
Dec
FOR LOOPS (with Numbers and Names)
by Maribel
No Comments
//FOR LOOPS let array = [23, 32, 44, 34] for number in array { print (number) } // FOR LOOPS WITH NAMES let...
08
Dec
WHILE LOOPS #3 – LOOP IN AN ARRAY
by Maribel
No Comments
//While loop in an array var array = [7, 23, 98, 1, 0, 763] a = 0 while a < array.count{ array [a]...
08
Dec
WHILE LOOPS #2
by Maribel
No Comments
More while loops. //Display the first 20 numbers in the seven times table // let multiplier = 7 let upperLimit = 20 var counter =...
08
Dec
WHILE LOOPS #1
by Maribel
No Comments
//While loops: A while loop performs a set of statements until a condition becomes false. These kinds of...
08
Dec
GAME: How Many Cats Do I Have?
by Maribel
No Comments
Cat photographed by and copyright of (c) David Corby (User:Miskatonic, uploader) 2006 Hi! Here’s the code for this game I created! import UIKit class...
28
Nov
LOGIN INFORMATION USING BOOLEANS
by Maribel
No Comments
Example #1 var usernameValid = true var passwordValid = true if usernameValid && passwordValid { print("Welcome back!") } else if !usernameValid && !passwordValid...
28
Nov
BOOLEANS WITH IF STATEMENTS
by Maribel
No Comments
In computer science, the Boolean data type is a data type, having two values (usually denoted true and false), intended to represent the truth values...
28
Nov
IF STATEMENTS WITH AND
by Maribel
No Comments
if name == “Maribel” && age >= 28 { print (“Access granted”) } else if name == “John” { print (“Access denied”) } && “and”...