This file contains 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 greeting = "Hello, playground" | |
var myAge = 19 | |
myAge = 20 | |
var surname = "Suienish" |
This file contains 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 x = 20 | |
let const = 7 | |
var x1 : Int = 13 | |
var x2 : Double = 6.2 |
This file contains 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 str1 = "WANTED" | |
var str2 = "" | |
var str3 = String() | |
str2 = "John" | |
str3 = "Wick" | |
print(str2 + " " + str3) |
This file contains 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 | |
//Practicing arrays | |
let constArray : [String] = ["a" , "b" , "c"] | |
constArray.count | |
var array1 = [String]() | |
array1.count == 0 ? print("is empty") : print("not empty") | |
array1 += constArray |
This file contains 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 | |
//let dict1 : [Int : String] = [0 : "mother", 1 : "father", 2 : "me"] | |
//let dict2 : Dictionary<String, Double> = ["father" : 44.0, "mather" : 41.0, "me" : 20.0] | |
let dict1 = [0 : "father", 1 : "mother", 2 : "me"] | |
dict1[0] | |
let family = ["father" : "Yermek", "mother" : "Raushan", "me" : "Daulet"] |
This file contains 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 | |
//let tuple1 : (Int, String, Double, Bool) = (1 , "Daulet" , 20.4, true) | |
let correctTuple = (6 , "Daulet" , 20.3, true) | |
let(favNumber, name, age, futureProgrammer) = correctTuple | |
favNumber | |
name | |
age |
This file contains 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 date : String? // ? automatically makes date nil | |
date = "03.12.2021" | |
/* | |
// some correct ways to show optionals | |
if date != nil { | |
print("date is \(date)") | |
} else { | |
print("not found") |
This file contains 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 | |
// for in | |
//for i in 0...50{ | |
// // if | |
// if i == 3{ | |
// break | |
// } | |
// print(i) | |
//} |
This file contains 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 | |
//func formula | |
/* | |
func funcName(input variable and type) -> outputType { | |
...some code... | |
} | |
*/ | |
func greet(person: String) -> String { | |
let greeting = "Hello, " + person + "!" |