Amazon.com Widgets Dot syntax vs. []
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 22, 2013, 03:20:06 PM
Home Help Search chat Login Register   
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+  Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+  Old Stuff
| |-+  Help!!!
| | |-+  Dot syntax vs. []
Pages: [1]   Go Down
Print
Author Topic: Dot syntax vs. []  (Read 892 times)
MarkReid
Full Member
***
Posts: 173






« on: May 07, 2009, 04:17:46 PM »

So far I'm working through chapter 9 and a question has occurred to me. Which is better to use, the dot syntax or the square brackets?

I use the square brackets to refer to methods but if I'm after a local variable value, for adding two local variable assigned to an object to one another for example, I'll use dot syntax.

What's your opinion on the use of one or the other, does it really matter if you refer to local object variables by one method over another?

The method that brought this to mind was [result setReal: real + [f real]...
I'd be inclined to write it [result setReal: real + f.real...
Logged
skochan
Administrator
Hero Member
*****
Posts: 3103







« Reply #1 on: May 07, 2009, 04:39:56 PM »

It's really just a matter of personal choice; however, the dot syntax is really designed to be used with properties (i.e,, instance variables).

Cheers,

Steve
« Last Edit: July 02, 2009, 04:05:23 PM by skochan » Logged
Pages: [1]   Go Up
Print
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.