First, comments
1. What is a note?
A comment is a string that is used in the code to illustrate, not execute.
2. What is the definition of a note?
In OC, we use a double slash "//" to denote a single-line comment, with a double slash (//) at the very beginning of the code.
NSLog (@ "This line of code is a single-line comment");
We also use "/*" and "/*" to denote multiple lines of comment.
/*
NSLog (@ "The Moon Light before the window");
NSLog (@ "suspected ground frost");
NSLog (@ "Jutou looking at the moon");
NSLog (@ "head down to think of hometown");
*/
3. What is the role of annotations?
Note, it is mainly used to describe the role of a piece of code, it can also be used to describe a class, the role of a method, and it can also be the parameters of the method and the return value of the data type of information such as description.
Annotations can also be a good way to debug a program. For example, if you suspect that a piece of code might have a problem, then we can annotate the code, and if it does not work correctly, then we can determine that there is a problem in the code. This allows you to adjust the scope of the investigation. On the other hand, if you still get an error, then you can be sure that this code is not a problem, and you can troubleshoot the usability of the code.
4. Note:
Multi-line annotations cannot be nested.
Second, the variable
1. What are the variables?
When we are programming data, we can imagine that "variables" are like a container that "dresses up" the data we need to process.
2. Use of variables?
Use the identifier as the name of the variable, and then we can assign the data to the variable.
int age = 25; Age is a variable and assigns a value of 25 to it.
Second, identifiers
1. What is an identifier?
is the symbol that gives the variable, class, method a name.
2. What are the rules for writing identifiers?
① identifiers can consist of letters, numbers, underscores, and dollar characters, but they cannot start with a number.
② cannot be the OC keyword.
③ cannot contain null characters.
④ can contain only dollar symbols and cannot contain other special characters.
02-objective-c Annotations and identifiers