What are Tokens in Objective-C ?

           

Objective-C Basic Syntax 


         An Objective-C project comprises of different tokens and a token is either a decisive word, an identifier, a steady, a string exacting, or an image. For instance, the accompanying Objective-C articulation comprises of six tokens:

NSLog(@"Hi, Objective C! \n");
The individual tokens are:;


NSLog
@
(
"Hi, Objective C! \n"
)
;

Semicolons ;


In Objective-C program, the semicolon is an announcement eliminator. That is, every individual articulation must be finished with a semicolon. It shows the end of one intelligent substance. 

For instance, taking after are two separate articulations:

NSLog(@"Hello, World! \n");
return 0;

Comments


Remarks are similar to helping content in your Objective-C system and they are disregarded by the compiler. They begin with/* and end with the characters */ as demonstrated as follows

/* Hi this is my first program in Objective-C */

You can not have remarks with in remarks and they don't happen inside a string or character literals.

Identifiers


An Objective-C identifier is a name used to distinguish a variable, capacity, or whatever other client characterized thing. An identifier begins with a letter start to finish or beginning to end or an underscore _ took after by zero or more letters, underscores, and digits (0 to 9). 

Objective-C does not permit accentuation characters, for example, @, $, and % inside identifiers. Objective-C is a case-delicate programming dialect. Along these lines, Manpower and labor are two separate identifiers in Objective-C. Here are a few samples of satisfactory identifiers:

mohd       zara    abc   move_name  a_123
myname50   _temp   j     a23b9      retVal

Keywords


The accompanying rundown demonstrates few of the held words in Objective-C. These saved words may not be utilized as steady or variable or whatever other identifier names.

autoelselongswitch
breakenumregistertypedef
caseexternreturnunion
charfloatshortunsigned
constforsignedvoid
continuegotosizeofvolatile
defaultifstaticwhile
dointstruct_Packed
doubleprotocolinterfaceimplementation
NSObjectNSIntegerNSNumberCGFloat
propertynonatomic;retainstrong
weakunsafe_unretained;readwritereadonly

White space in Objective-C

A line containing just whitespace, conceivably with a remark, is known as a clear line, and an Objective-C compiler completely disregards it. 

Whitespace is the term utilized as a part of Objective-C to portray spaces, tabs, newline characters and remarks. Whitespace divides one a piece of an announcement from another and empowers the compiler to distinguish where one component in an announcement, for example, int, closes and the following component starts. Accordingly, in the accompanying explanation:

int total;
There must be no less than one whitespace character (generally a space) in the middle of int and age for the compiler to have the capacity to recognize them. Then again, in the accompanying articulation,

total = basic_total+ other_total;   // get the total amount
no whitespace characters are important in the middle of products of the soil, or in the middle of = and fruits, despite the fact that you are allowed to incorporate some on the off chance that you wish for lucidness reason.




0 comments:

Post a Comment

My Instagram