I passed the Objective-C test on it.mail.ru and I want more information.
Question: “What will happen?” (_InstanceVariable is an object, ivar of the current object)
^{ NSLog(@"%@ ", _instanceVariable); } Variants of answers:
- Nothing
- self
- _instanceVariable
- both that, and that
I replied: "nothing", and this was noted as an incorrect answer. I see the error in my logic, _instanceVariable will be captured by the block. But will self-banning be?
I would also appreciate a clear description of the cases in which ivar is used. All I found in the documentation is:
I did not become clearer.