objective c - Why do functions use -(void) and not -(nil) in Obj-C? -


Objective- I often see functions that do not declare anything:

  - (zero) myFunction {single ?? |   

but why zero , this way

  - (zero) myFunction {a ?? |   

They both do not return "nothing"?

Historically in the related languages ​​(syntax) as the language of C-language, Zero indicates that no type is being returned from the function.

More precise, in the form of variables (or related to it) given type , there are also types in functions, for example, a function that returns an integer A int type function or a function whose int is the same even if it gives something else.

If the function does not return anything - it does not return anything - how is it related? It does not have any type, and zero type represents such a thing.

I do not know in Objective-C, but if I correctly understand, like the zero id (or any type of ID), almost like an underlying implementation.

and faucet is a (zero *) type, later an typeless indicator can indicate anything, as if it were in C And C ++

Any such function which gives zero, it will mean that it is any type of ID, it is also not known that it also makes sense. So then and there, there is a type (any type?) Before (zero) myfunction is a type (zero) myFunction also no.

In addition to this, zero is an inherent constant; Returning Nile is like saying that your function returns a specific number for example ( (1) myFunction ). It will not make any sense, is not it?

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -