syntax - Documentation for Ruby 4.0
Description: syntax: layout. literals.
Keywords: ruby,documentation,syntax

🔍

No recent searches

# Ruby Syntax

The Ruby syntax is large and is split up into the following sections:

Code Layout

  Breaking code in lines

Literals

  Numbers, Strings, Arrays, Hashes, etc.

Assignment

  Assignment and variables

Control Expressions

  `if`, `unless`, `while`, `until`, `for`, `break`, `next`, `redo`

Pattern matching

  Structural pattern matching and variable binding syntax

Methods

  Method and method argument syntax

Calling Methods

  How to call a method (or send a message to a method)

Modules and Classes

  Creating modules and classes including inheritance

Exceptions

  `Exception` handling syntax

Precedence

  Precedence of ruby operators

Refinements

  Use and behavior of the refinements feature

Miscellaneous

  `alias`, `undef`, `BEGIN`, `END`

Comments

  Line and block code comments

Operators

  Operator method behaviors