Possible Duplicate:
What's the difference between dot syntax and square bracket syntax?
I've tried using these two expressions:
[[[self display] text] stringByAppendingFormat:digit];self.display.text = [self.display.text stringByAppendingFormat:digit]
Where display is a UILabel and digit is an NSString.
I intend to set digit as the label's text, but when I was trying to run the program, only #2 gave the correct results.
So what exactly is the difference between those two expressions? Is it incorrect to use square brackets for the getter and setter?
I have checked this similar question, What's the difference between dot syntax and square bracket syntax?, but still cannot figure it out.