Ruby – Programming Basics For Kids

Why’s Poignant Guide to programming Ruby is aimed at making ruby programming basics simple and fun, with lots of examples children can learn. Perfect for introductory programming classes, self-study or in home-school or classrooms. Packed full of cartoon images of foxes and cryptic stories. Perfect to keep unruly teenagers entertained!



Sample Text from the Book

1. Opening This Book
Pretend that you’ve opened this book (although you probably have opened this book), just to find a huge onion right in the middle crease of the book. (The manufacturer of the book has included the onion at my request.)

So you’re like, “Wow, this book comes with an onion!” (Even if you don’t particularly like onions, I’m sure you can appreciate the logistics of shipping any sort of produce discreetly inside of an alleged programming manual.)

Then you ask yourself, “Wait a minute. I thought this was a book on Ruby, the incredible new programming language from Japan. And although I can appreciate the logistics of shipping any sort of produce discreetly inside of an alleged programming manual: Why an onion? What am I supposed to do with it?”

No. Please don’t puzzle over it. You don’t need to do anything with the onion. Set the onion aside and let it do something with you. I’ll be straight with you. I want you to cry. To weep. To whimper sweetly. The Ruby programming basics is a poignant guide to Ruby. That means code so beautiful that tears are shed. That means gallant tales and somber truths that have you waking up the next morning in the arms of this book. Hugging it tightly to you all the day long. If necessary, fashion a makeshift hip holster for Why’s (Poignant) Guide to Ruby, so you can always have this book’s tender companionship. You really must sob once. Or at least sniffle. And if not, then the onion will make it all happen for you.

A Quick (and Hopefully Painless) Ride Through Ruby (with Cartoon Foxes)

Yeah, these are the two. My asthma’s kickin in so I’ve got to go take a puff of medicated air just now. Be with you in a moment.

I’m told that this chapter is best accompanied by a rag. Something you can mop your face with as the sweat pours off your face.

Indeed, we’ll be racing through the whole language. Like striking every match in a box as quickly as can be done.

1. Language and I MEAN Language

My conscience won’t let me call Ruby a computer language. That would imply that the language works primarily on the computer’s terms. That the language is designed to accomodate the computer, first and foremost. That therefore, we, the coders, are foreigners, seeking citizenship in the computer’s locale. It’s the computer’s language and we are translators for the world.

But what do you call the language when your brain begins to think in that language? When you start to use the language’s own words and colloquialisms to express yourself. Say, the computer can’t do that. How can it be the computer’s language? It is ours, we speak it natively!

We can no longer truthfully call it a computer language. It is coderspeak. It is the language of our thoughts.

Read the following aloud to yourself.

5.times {  print  Odelay!” }

In English sentences, punctuation (such as periods, exclamations, parentheses) are silent. Punctuation adds meaning to words, helps give cues as to what the author intended by a sentence. So let’s read the above as: Five times print “Odelay!”.

Which is exactly what this small Ruby program does. Beck’s mutated Spanish exclamation will print five times on the
computer screen.

Read the following aloud to yourself.

exit unless  restaurant“.include?  “aura

Here we’re doing a basic reality check. Our program will exit (the program will end) unless the word restaurant contains (or includes) the word aura. Again, in English: Exit unless the word restaurant includes the word aura.

Ever seen a programming language use question marks so effectively? Ruby uses some punctuation, such as exclamations and question marks, to enhance readability of the code. We’re asking a question in the above code, so why not make that apparent?

Read the following aloud to yourself.

[‘toast‘, ‘cheese‘, ‘wine‘].each { |food| print food.capitalize }

While this bit of code is less readable and sentence-like than the previous examples, I’d still encourage you to read it aloud. While Ruby may sometimes read like English, it sometimes reads as a shorter English. Fully translated into English, you might read the above as: With the words ‘toast’, ‘cheese’, and ‘wine’: take each food and print it capitalized.

The computer then courteously responds: Toast, Cheese and Wine.

<end of excerpt>

See more books for School Projects below



Sponsored Links:

Note – if you sign up through these links, it doesn’t cost you any extra, but FKB receives a small donation, which helps us with our project to buy more FREE Hardcopies   for kids who need them

All our posts are checked by Grammarly, the FREE online grammar checker (We still receive a donation even if you only sign up for the free account :-):

Spread the love

Comments 4

Leave a Reply

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