A
A
Akira Kubo2015-03-29 23:03:39
Swift
Akira Kubo, 2015-03-29 23:03:39

What does nil mean in Swift?

Sorry for the possibly dumbest question, but I'm wondering what nil means by itself and in this context:
var SampleT = "123"
var Sample = SampleT.toInt()
if Sample != nil {
println("100 + 23 = \(Sample )")
}
var SampleText: String? = "Hello"
SampleText == nil

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2015-04-01
@AkiraKubo

nil analogue of NULL
in this case, as an option, an empty or uninitialized string

A
Alexander, 2015-03-29
@NeiroNx

nil is a constant with a "missing" value - or a nonexistent value. Many functions return this value on failure and error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question