Teaching Kids to Program


OK, I sat down my niece and nephew before bed, and we had a little period of Intro to Programming. It lasted about 15 minutes. Not their fault at all. I talked to my sister-the-educator about it later and she nodded knowingly. I wasn’t prepared. So I’ve written up the final-state program here. It’s a simple Ruby command line question that has a loop. My niece, who is 9, asked all the right questions. “What are you doing?” being the main one.

Note to self that VI is probably not the best tool, especially as its tiny and doesn’t use the mouse. When I opened BBEdit with all of its colors and bells and whistles, that got a smile.

This is the same niece that has helped me with Cootie Catcher and understands the concept of an iPhone emulator, so she’s already got a head start.

puts "What is your name?"
name = gets.chomp
puts "Hello " + name + "\nYou are awesome\n"
puts "Ask me a question."

question = gets.chomp

puts "You want me to answer: " + question + "?"
response = gets.chomp
response == "No" ? a= "Why not?" : a=  "Giraffe"
puts a
while(response == "No")
  b = gets.chomp
  puts b
  response = gets.chomp
end