Category: 2. Features
-
Keywords
In Ruby there are approximately 42 keywords which can’t be used for other purposes. They are called reserved words.
-
Statement delimiters
Multiple statements in a single line must contain semi colon in between but not at the end of a line.
-
Missing method
If a method is lost, Ruby calls the method_missing method with name of the lost method.
-
Singleton methods
Ruby singleton methods are per-object methods. They are only available on the object you defined it on.
-
Method names
Methods are allowed to end with question mark (?) or exclamation mark (!). By convention, methods that answer questions end with question mark and methods that indicates that method can change the state of the object end with exclamation mark.
-
Naming conventions
Ruby defines some naming conventions for its variable, method, constant and class.
-
Variable constants
In Ruby, constants are not really constant. If an already initialized constant will be modified in a script, it will simply trigger a warning but will not halt your program.
-
Dynamic typing and Duck typing
Ruby is a dynamic programming language. Ruby programs are not compiled. All class, module and method definition are built by the code when it run. Ruby variables are loosely typed language, which means any variable can hold any type of object. When a method is called on an object, Ruby only looks up at the…
-
Visual appearance
Ruby generally prefers English keyword and some punctuation is used to decorate Ruby. It doesn’t need variable declaration.