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 ...

Get Ruby For Kids For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.