Swift
Swift νμ μΊμ€ν
eddie0329
2021. 11. 28. 16:15
λ°μν
π λͺ©λ‘
- is
- as
π is
is λ νμ μ ꡬλΆν λ μ¬μ© λ©λλ€.
print("TypeCheck \(2 is Int)") // true
π as
as λ νμ μ μΊμ€ν ν λ μ¬μ© λ©λλ€.
asλ !
, ?
λ‘ μ¬μ© ν μ μμ΅λλ€.
var testType: String = "2"
var testType2 = testType as? Int
if(testType2 is Int?) {
print("HELLO")
}
λ°μν