Nothing to do with cats!
When we are using repeats to print to the screen, it is better if we don’t just print the same thing over and over again. There are better ways to use 10,000 times the age of the universe, I’m sure you’ll agree.
Start the 2Code lesson Concatenation
. You can search for it, or find it in 2Code | Coding Principles, below the Gibbon level lessons.
When you get to Challenge 3, here’s a hint on how to concatenate.
For Challenge 4, do the same again and remember to actually put a space in the box. Use the spacebar on your keyboard.
Here is a hint for Challenge 6. Adding the full stop to each sentence is tricky. Can you do it?
Save your work in your 2Code folder with a sensible filename.
So what is concatenation
exactly?
Concatenation is joining two pieces of text with the plus operator
.
When you do "A happy" + "brown rat"
in code, the second piece gets put on the end of the first. That’s called concatenation
.
"A happy" + "brown rat"
> "A happybrown rat"
Notice that we don’t get a space between the two pieces of text. This is because there are no spaces in the input. Concatenation will not add any spaces for you.
Recode the concatenation lesson in Free Code Gorilla.
Can you?