Ruby emphasizes simplicity and developer happiness with elegant syntax and powerful features like blocks and metaprogramming. Browse the topics below to learn step by step or jump to what you need.
Your first Ruby script and how to run it.
Strings, numbers, booleans, nil, and dynamic typing.
Local, instance (@), class (@@), and global ($) variables.
Uppercase identifiers and constant reassignment warnings.
if/else, unless, case/when, loops, and modifiers.
Ordered, dynamic collections with rich methods.
Key-value maps with symbol and string keys.
def, parameters, defaults, splat, keywords; expressions.
Closures with yield, do..end, and powerful collection methods.
Everything is an object: classes, instances, methods, inheritance.
Namespaces and mixins with include/extend/prepend.
Object state with @var and encapsulation.
Shared state via @@var; caveats with inheritance.
Immutable identifiers for keys and names.
Mutable strings, interpolation, encodings.
Regex literals and matching in Ruby.
begin/rescue/ensure; custom exception types.
Reading/writing files with block safety and encodings.
map, select, reduce with Enumerable.
Dynamic methods, method_missing, eval family.
Single inheritance, super, method lookup chain.
Visibility for variables/methods and binding objects.
Callable objects, argument rules, return behavior.
Visibility, callbacks, include vs extend vs prepend.