why's (poignant) guide to ruby

About This Book

by _why the lucky stiff  ·  CC BY-SA 2.5
Original DomainRuby ProgrammingClassic 2003–2009
Chapter 1 illustration

At my local Barnes and Noble, there is a huge wall of Java books just waiting to tip over and crush me one day. And one day it will.

This is just a small Ruby book. It won’t crush you. It’s light as a feather. And there’s a reason this book will stay light: because Ruby is simple to learn. I’ve written this for the person who wants to learn Ruby with minimal pain.

About the Poignant Guide illustration

Who Should Read This Book

This book is for the beginner. I’m not going to assume you know anything about programming. If you’ve never programmed, this book is for you. If you’ve programmed in other languages but not Ruby, this book will work for you too. Though you may find some sections slow.

The book goes through Ruby concepts at a reasonable pace. We don’t dawdle. But we don’t rush. If you have questions, try things in irb. Experiment. Break things. That is the way.

How to Learn Ruby

The best way to learn Ruby is to experiment. Open up irb — the interactive Ruby interpreter — type in code, and see what happens. Every Ruby installation includes irb. Start it from your terminal:

$ irb
irb(main):001:0> puts "Hello, world!"
Hello, world!
=> nil
irb(main):002:0> 2 + 2
=> 4
irb(main):003:0> "chunky bacon".upcase
=> "CHUNKY BACON"

See that? You typed a Ruby expression, and irb printed the result. That’s the whole loop. Type, see, understand, continue.

How to Use This Book

Each chapter builds on the previous one. Read in order. Try every code example by typing it into irb or saving it to a .rb file and running it with ruby filename.rb. Don’t just read. The only way to learn programming is to write programs.

This book is released under the Attribution-ShareAlike License. You may distribute it freely, but you must give attribution and keep the same license. You may not sell it.

About the Poignant Guide — second illustration

Why's (Poignant) Guide to Ruby is released under the Creative Commons Attribution-ShareAlike 2.5 license. Written by _why the lucky stiff, originally published 2003–2009. Preserved at its original domain. Images © _why the lucky stiff, CC BY-SA 2.5.

→ AI Detector Benchmark & Research Hub