From 50b1fb03172790c7fef578379b476b29572d534c Mon Sep 17 00:00:00 2001 From: Sergii Suprun Date: Sun, 4 Nov 2018 12:21:36 +0200 Subject: [PATCH] Homework 0 #1 --- .../{homework_1 => homework_0}/README.md | 0 .../task_1.playground/Contents.swift | 102 ++++++++++++++++++ .../task_1.playground/contents.xcplayground | 4 + .../contents.xcworkspacedata | 7 ++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ 5 files changed, 121 insertions(+) rename homeworks/sergii.suprun_differz/{homework_1 => homework_0}/README.md (100%) create mode 100644 homeworks/sergii.suprun_differz/homework_0/task_1.playground/Contents.swift create mode 100644 homeworks/sergii.suprun_differz/homework_0/task_1.playground/contents.xcplayground create mode 100644 homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/contents.xcworkspacedata create mode 100644 homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/homeworks/sergii.suprun_differz/homework_1/README.md b/homeworks/sergii.suprun_differz/homework_0/README.md similarity index 100% rename from homeworks/sergii.suprun_differz/homework_1/README.md rename to homeworks/sergii.suprun_differz/homework_0/README.md diff --git a/homeworks/sergii.suprun_differz/homework_0/task_1.playground/Contents.swift b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/Contents.swift new file mode 100644 index 0000000..1b9f9aa --- /dev/null +++ b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/Contents.swift @@ -0,0 +1,102 @@ +import UIKit + +var str = "Hello, playground" + +let string :String = "Hello" +print(string) + +let bool :Bool = false +print(bool) + +let int: Int = 12 +print(int) + +let int8: Int8 = 127 +print(int8) + +let int16: Int16 = -32768 +print(int16) + +let int32: Int32 = Int32.min +print(int32) + +let int64: Int64 = Int64.max +print(int64) + +let uint: UInt = 256 +print(uint) + +let uint8: UInt8 = 255 +print(uint8) + +let uint16: UInt16 = 65535 +print(uint16) + +let uint32: UInt32 = UInt32.max +print(uint32) + +let uint64: UInt64 = UInt64.max +print(uint64) + +let float: Float = -1.1 +print(float) + +let float80: Float80 = 1.2 +print(float80) + +let double: Double = 1.3 +print(double) + +let http404Error = (404, "Not Found") +print(http404Error) + +let threeDoubles = Array(repeating: 0.0, count: 3) +print(threeDoubles) + +let favoriteGenres: Set = ["Rock", "Classical", "Hip hop"] +print(favoriteGenres) + +let map = [1: "one", 2: "two"] +print(map) + +print(Int64.max==UInt64.max/2) + +// 4. loops +for index in 1...10 { + print(index) +} + +var index = 0 +while index < 10 { + index+=1 + print(index) +} + +index = 0 +repeat { + index+=1 + print(index) +} while index < 10 + +// 5 String init +let s :String = "new" +let name = "John" +let someString = "Hello \(name)!" +let empty = String() +let another = String.init() +let repeated = String(repeating: "a", count: 3) +let multiple = """ + The White Rabbit + """ +let idx = someString.firstIndex(of: " ") ?? someString.endIndex +let beginning = someString[.. + + + \ No newline at end of file diff --git a/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/contents.xcworkspacedata b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/homeworks/sergii.suprun_differz/homework_0/task_1.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + +