tuples - Difference between nil and () in Swift -
I noticed that empty tuple () is used to represent the absence of value in Swift, for example, a The signature of the function, which does not return anything, is:
func zz () {println ("zz")} Also accept this body for the version:
func zz () {println ("zap") returns () // return () and returning nothing is the same thing is! } This will be the same method of defining the function:
func zz () - & gt; There is also a typo for the zero () (zero): Typical zero = () / code> If there is absence of value in empty tubal swift, then is there any relation? Why do we need both concepts?
zero is a special value that you have an optional which means that there is no value in the alternative. zero is not really the absence of a value, it is a special value, which means there is no fair value () means something Even not returned (or in passed), even an alternative, there is no return value, nor can it ever be that you can not do anything against it, instead of zero. The difference between the position (C) is
void foo (zero); and
some type * times (zero); If the latter function uses the return value of NULL to indicate any type of failure .e. someVariable = foo (); // Invalid some variable = bar (); // is not illegal (some variables! = Null) {...}
Comments
Post a Comment