I’m going to try to teach my 9 year old to program this weekend. My first thought was to do scratch, and that seems kind of good, but I think BASH might just be a great place to go as well.
Bash is found on the MAC and Linux which comprises every computer in our house. (we have a few windows VMs here and there but nothing we use). And bash is fun cause you can get familiar with the command line. We’ll start by using pico maybe? And do a simple hello world program first:
Program #1:
#!/bin/bash
echo “Hello World!”
That’s pretty easy, but the next fun thing is to make it ask and answer a question:
Program #2:
#!/bin/bash
echo “What is your favorite color?”
read color
echo “${color} is a nice color”
Program #3:
#!/bin/bash
echo “What is your favorite color?”
read color
echo “${color} is a nice color”
if [ “$color” == “red” ]
then
echo ${color} is my favorite!
fi
Program #4
#!/bin/bash
echo “Can you guess my favorite color?”
while true
do
read color
if [ “$color” == “red” ]
then
echo “You guessed it! ${color} is my favorite color!”
break
else
echo “Nope. $color is not my favorite color. Guess again!”
fi
done
We’ll probably make it ask a few other questions and then some other cool things. Might be fun!
Comments are closed.