Ruby basics from irb to collections

8 steps · about 4 h 5 min · Beginner

  1. Try Ruby interactively in irb (tutorial, Ruby-lang.org, 20 min)

    An interactive prompt makes Ruby's everything-is-an-object idea concrete in minutes.

  2. Define methods and interpolate strings (tutorial, Ruby-lang.org, 15 min)

    Small methods with default arguments are the building blocks of every Ruby script.

  3. Wrap behaviour in a class (tutorial, Ruby-lang.org, 20 min)

    Classes and instance variables show how Ruby organises state and behaviour.

  4. Branch and loop the Ruby way (reference, Ruby documentation, 30 min)

    if, unless, case and modifier forms let you write conditions that read naturally.

  5. Master method arguments (reference, Ruby documentation, 30 min)

    Keyword, optional and block arguments are everywhere in Ruby libraries.

  6. Transform arrays with blocks (reference, Ruby documentation, 40 min)

    map, select and each_with_index replace most manual loops; scan the method list with examples.

  7. Store key-value data in hashes (reference, Ruby documentation, 30 min)

    Hashes with symbol keys are Ruby's standard record type for config and data.

  8. Practise with mentored exercises (interactive, Exercism, 1 h)

    Solving small graded problems turns syntax you have read into code you can write.