3. identifier
An identifier is a name.
An identifier consists of letters, numbers, and underscores, but cannot begin with a number. It cannot contain blank or non-printable characters, or punctuation marks.
The identifier that starts with 26 uppercase letters from A to Z is a constant.
Class and module name must begin with an uppercase letter; otherwise, an error is reported.
I
X2
Old_value
_ Internal #
Pi # constant
By convention, a very large number of multi-byte identifiers are underlined to separate multiple bytes, such as "like_this", while a multi-byte constant is "likethis" or "like_this ".
Note:
1. Case sensitivity
2. Unicode characters in the identifier
3. punctuation marks in the identifier
Punctuation Marks can appear at the beginning or end of a ruby identifier. They have the following meanings:
$ A global variable starts with a dollar sign
@ Instance variables start with a @ symbol, while class variables start with two @ symbols.
? As a useful convention, methods that return boolean values usually have a name ending with a question mark.
! Some methods end with an exclamation point, which reminds you to be careful when using these methods. This naming convention is usually used to differentiate two methods: Methods ending with an exclamation point usually change the objects that call them. methods that do not end with an exclamation point will not modify the objects that call them, instead, it modifies a copy of the original object and returns the result.
= If the method name ends with an equal sign, you can omit this number when calling this method. This method is usually placed on the left side of the value assignment operator.
$ Files
@ Data
@ Counter
Empty?
Sort!
Timeout =