1,BreakJump out of layer Loop
2,NextIgnore the remaining part of this loop and start the next loop
3,RedoStart the loop again, or start from this time
4,RetryStart the loop body again
5. $ array <value adds value to the array $ array as an element of the array
6,Attr_writer: Username is equivalent
Def username = (value)
Return @ username = Value
End
ATTR _ Reader: Username is equivalent
Def Username
Return @ username
End
7,Attr_accessor: Username is equivalentAttr_reader: Username;Attr_writer: Username
Similar to the getter and setter methods in Java
8,Sometimes "! ","? ",! It implies that this method is destructive and may change the input parameters ,? Indicates that this method is a Boolean method. Only true or false is returned.
9. Definition of Singleton method in ruby: First, you must generate an instance object, and then add the object name and a period before the method name ".",
For example, Def obj. Meth indicates that the method meth only belongs to the object obj.
10. Symbols used for inheritance in ruby<Indicates
11. Method scope in ruby: public protected private
The public and Java classes are the same.
The protected method can be accessed by defining its class and its subclass. It cannot be directly called by the Instance Object of the class and subclass, but can be specified to the instance object in the class and subclass;
Private method, which can be accessed by its class and its subclass. Private methods cannot specify objects.
In Ruby, both the private and protected methods can be inherited by the quilt class.