Have a go at coding…

Learning to code is for everyone and it is fun, create digital art, make games, explore AI, IoT and robotics.

This is an opportunity to have a go at coding, you don’t need to understand it but you can learn through doing. If you want to learn how to code then I have a course for you as a series of eBooks (kindle on Amazon) which you can use on any device (you don’t need a kindle) even your phone. Click on this link https://www.amazon.co.uk/dp/B09KPVLBL1 for the first book in the series or visit the home page on www.thehappycoder.org.

Here you can have a go by typing in the code and running it. These are just coding snippets or doodles. So if you have never coded before here is your chance to try for free. You can’t fail, you can only try. Just follow the instruction below:

  1. delete to code that is already there below,
  2. type the code that is below,
  3. take care to do it exactly as shown,
  4. Press the play button,
  5. try changing things to see what happens,
  6. that is the best way to learn, play, experiment and try things.

The web editor, delete the code below…

…now add this code

let x = []
let y = []
function setup()
  createCanvas(400, 400)
  for(let i = 0; i < 20; i++)
    x[i] = random(width)
    y[i] = random(height - 50)
function draw()
  background(0, 100, 100)
  text('move your mouse around the screen', 10, height - 20)
  for(let i = 0; i < 20; i++)
    stroke(255, 255, 0)
    fill(0, 100, 100)
    line(x[i], y[i], mouseX, mouseY)
    circle(x[i], y[i], 20)
    circle(mouseX, mouseY, 20)