In objective-c, the end result is the !variablesame. variable==nilAlso, I think I read somewhere that iVars are initialized to "nil" (ie o), but unfortunately I cannot find where I noticed this now . If I am right, is this initialization for the zero part of the iVar declaration or is it related to something like @property?
!variable
variable==nil
i.e. they value the same ...
if(!myObject) ...
and
if(myObject == nil) ...
Greetings to Gary.
Edited: hopefully for clarity.
Your question, question and question seem to be asking different things, so ...
: , ! nil . ! - , (.. !0 1 ! - 0), nil - 0.
!
nil
!0
1
: , !foo foo == nil . , 0. .
!foo
foo == nil
! C- , (, & || ).
nil - .
TRUE, NULL nil.
NULL
, if(!myObject) if(myObject==nil) .
if(!myObject)
if(myObject==nil)
In objective-c, it !is a Boolean operator and returns the opposite value of a boolean or expression. In the example below, myObj really evaluates this pointer value as Boolean, zero, or nonzero. Since myObj is a non-zero pointer, this evaluates to true.! myObj will return the opposite, in which case it will return false.
id myObj = nil; int x = 0; if (myObj) x++;
Source: https://habr.com/ru/post/1776304/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776299/use-this-to-simplify-code-simple-jquery&usg=ALkJrhiFkkLj6oZHljDYvQR4QZ0wLITiKQDoctrine select statement always returns all table fields - phphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776301/django-linking-my-models-to-profiles-userprofile-model&usg=ALkJrhjfhU6_zzyEcToiZMC0IunzvWbFIgclisp 2.49: asdf cannot find asd - common-lispGAE voice modeling - google-app-enginea simple mistake c makes a pointer out of the whole without casting - cAndroid: How to program EAP wifi configuration programmatically? - androidDjango and thread security - pythonSpring AOP with anonymous inner classes - javaRMISecurityManager vs SecurityManager - javaAll Articles