Solution :
Now I will try explain you what Optionals are really mean in swift.
Another way to declare the optional variable as below :
var o : Optional<Int>
And the Optional type is nothing but the enumeration with below two cases, i.e
enum Optional<Wrapped> : ExpressibleByNilLiteral {
case none
case some(Wrapped)
.
.
.
}
So to assign the nil to our variable 'o'. We can do like var o = Optional<Int>.none or to assign the value, we will pass some of the value var o = Optional<Int>.some(30)
According to the swift, 'nil' is a absence of value. And to create the instance initialized with the nil We have to conform to the protocol called ExpressibleByNilLiteral and it will be great if you guessed it, only the Optionals conform to the ExpressibleByNilLiteral and conforming to any other types is discouraged.
ExpressibleByNilLiteral has the single method called init(nilLiteral:) which will initialize the instace with nil. Usually do not call this method and according to the swift documentation it is now discouraged to call this initializer directly as a compiler calls it when you initialize the Optional type with nil literal.