Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Session 12

import Foundation
import Glibc

/*
var name: String?
/*
//-Force unwrapp
print(name!)
*/

/*
//-Optional Binding
if let myname = name{
    print(myname)
}
*/

/*
//-Defult Value
print(name ?? "t")
*/

var test: String?
test = "123"

//1St  (Forced Unwrapping)
print(test!)

//2nd Optional Binding
if let tes = test {
    print(tes)
}

//3rd Default
print(test ?? "t")
*/

//Guard
func test2() {
let ss: String?
ss = "sdd"
    guard let num = ss else {
    print("Error")
    return
    }
    print("ss!")
}
test2()






Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.