Sponsored by:

Kids and Code: Conditions and loops

Last week I published the first post of Kids and Code where I started recording the process of teaching my six-year-old son to code. We used code.org which is just awesome, specifically the Minecraft game which has just the right balance of difficulty, engagement and entertainment. It’s mostly dragging and dropping blocks which represent procedures, but it’s a great way of getting kids to think about the structure that goes into code. Even at six years old, Ari picked it up very quickly and is genuinely enjoying it, so we recorded another one with some more advanced concepts.

Here’s another short clip where he starts using two fundamental coding constructs. Firstly, there are conditions – “if a condition is met, then perform a task” – which is an absolutely essential component of any software development. Next there are loops – “repeat something over and over again” – also fundamental in the code all software professionals write. Here’s how he went:

Consider the behaviours he’s able to demonstrate here:

  1. Nesting: He has to get the “if” condition nested within the repeat control. I really like the way this is visualised here where you can clearly see the contrasting colours and drag blocks within different levels of nesting.
  2. Reading code: We talk about how the cobblestone is only being laid when there’s lava and I ask him to show me where in the code this is happening. Actually being able to understand the coding construct that causes the behaviour is a really key skill.
  3. Code optimisation: Towards the end, he begins by trying to add another “destroy block” command after his loop. We talk about how he can use his existing loop by simply incrementing the times it’s repeated instead.

The other thing I’ve noticed the more he does this is how suitable the touch screen is for young kids. You can see him using his finger on the screen the whole time rather than the mouse, not by my prompting but just because he’s obviously finding this to be a more intuitive user interface. The Lenovo Yoga 900 I wrote about in the previous post is perfect for this and it means that as we progress through his education he can learn the fundamentals of using a PC as well as how to interact with modern touch-enabled applications.

Teaching kids to code is an enormously valuable thing to do with your time and I had several friends reach out to me after the last post with a renewed enthusiasm. It doesn’t necessarily mean you’re setting your kids on a path to be a software developer, rather you’re empowering them to better understand the increasingly technological world they live within today.

I’ll leave you with this very short clip of Obama encouraging kids to get into the hour of code in 2014 and I especially like this segment of the video:

Don’t just consume things, create things. Take an hour to learn more about the technology that touches every part of our lives.

That’s not just our present reality, it’s their future too so help them to be a part of it.

Kids
Tweet Post Share Update Email RSS

Hi, I'm Troy Hunt, I write this blog, create courses for Pluralsight and am a Microsoft Regional Director and MVP who travels the world speaking at events and training technology professionals