O'Reilly logo

Ruby For Kids For Dummies by Christopher Haupt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Project 4

Shapes

In this project, you’ll begin to use your programmer’s editor to write code and get into the flow of programming, testing, and debugging your software using your terminal program.

You’ll create a simple program that can generate a couple of geometric shapes using ASCII art to draw the outline and fill the shape with a pattern.

You’ll also allow the user of your program to customize the output’s size a bit by learning how to collect simple input from the user.

image

Organizing a New Project

Up until this project, you’ve been using Interactive Ruby (IRB) to write and test your code. The nice thing about IRB is that you can get a feel for what the code is going to do immediately. This works great for small snippets of Ruby, but as you start to create more complicated programs, and as they get longer, IRB isn’t very forgiving if you make typos or want to easily change or save your work.

In this project, you’re going to start using Atom, the programmer’s editor you installed in Project 1 to write and store code in files. You’ll continue to use the terminal program to use a different Ruby command to run and test the code stored in the files you create.

tip Before each project, you’ll want to get organized by keeping all your work for the project together in an easy-to-find ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required