As part of my professional development plans for the year, I’m learning the Ruby language and the Ruby on Rails framework. Now, I’m just getting started so I’m a complete newbie, but here’s the first program that we all write when we’re learning a language: Hello, world!

I’m using the “irb” REPL command instead of actually saving source file(s) at this point. Here’s how I started:

Output: Hello, world!

Basic, right? Now, let’s take some user input, and say hello to an entered name.

Input: Russell
Output: Hello, Russell!

If you just use gets, you will also receive the newline character on the input. The chomp function removes this character.

That’s all for now. I’ll be creating more posts as I continue learning Ruby.

Leave a Reply

Your email address will not be published. Required fields are marked *