Created
October 15, 2018 03:27
-
-
Save peterkos/8e0ed2319e9c614d1e5abfe9e39986b0 to your computer and use it in GitHub Desktop.
Code written on Week 0 of the iOS Development Workshop, Autumn 2018, w/ Dubstech
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// var -- Variable (value can change) | |
// let -- Constant (value cannot change) | |
var str = "Hello, playground" | |
str = "My New String" | |
var myNum = 5 | |
// The line below gives an error! | |
//myNum = "a string" | |
var anotherNum: Double = 5.0 | |
let anotherOtherNum: String = "Text" | |
// jaosdfjl;askfjas;dlkfja;lfijawelfkj | |
/* | |
alsdjfladskf | |
alskdfa;sklfjasdf | |
jsalkfjasdfk | |
*/ | |
let theRealVIP = "Bill Nye" | |
if theRealVIP == "Bill Nye" { | |
// print("BILL BILL BILL BILL BILL BILL") | |
} else { | |
// print("π ") | |
} | |
let π = "happy" | |
print(π) | |
// Loops | |
/* | |
for (int i = 0; i < 10; i++) { | |
System.out.println(i); | |
} | |
*/ | |
// 2 "range operators" | |
// 0...10 0 1 2 3 4 5 6 7 8 9 10 | |
// 0..<10 0 1 2 3 4 5 6 7 8 9 | |
for i in (0..<10).reversed() { | |
// print(i, terminator: "") | |
} | |
//print("\nafter for loop") | |
// Arrays | |
var groceries = ["Banana", "Apple", "Pear"] | |
var amountOfSodas: [Int] = [1, 2, 3, 4, 5] | |
for item in groceries { | |
print(item) | |
} | |
groceries.append("Apple") | |
print(groceries.count) | |
// String Interpolation | |
let name = "Peter" | |
// System.out.println("Hello, " + name); | |
print("Hello, \(name)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment