Doll duck learn ruby-3, identifier

Source: Internet
Author: User
Tags printable characters uppercase letter

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 =

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.