Tuesday, October 25, 2016

Coding #2

Iv'e been review some of the things I did in year 5 and I found this a basic coding 'if statement '. If you have no idea what im talking about check out this good website, codeavengers

Here is the code:

var guess = prompt('8 + 4 + 2 + 1 ?')

if (guess == '15')
  alert('Correct!')
else
  alert('Incorrect!')
 
guess = prompt('8 - 4 - 2 - 1 ?')

if (guess == '1')
  alert('Correct!')
else
  alert('Incorrect!')

No comments:

Post a Comment