From: Hayden Smith Date: 2008-05-08T19:27:21+09:00 Subject: initial stages of scripting ------=_NextPart_000_0113_01C8B149.E77850D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi there, I'm a relative newbie when it comes to scripting in ruby however, for a = year 11 project at school, it is necesary for me to program a maths = utilit which requests a user - elementary school aged - to add to = numbers together to reach an answer. I've effected some coding however, = I'm a little stumpt as to why the aplet is not correctly parsing through = the loops. =3D=3D=3Dscript extract starts=3D=3D question =3D 1 unless question =3D=3D 20 score =3D 0 number_of_questions =3D 0=20 num1 =3D rand(20)=20 num2 =3D rand(20)=20 correct_answer =3D num1 + num2 puts("What is #{num1} + #{num2}/?") user_answer =3D gets.chomp!.to_i unless user_answer =3D=3D correct_answer puts("Sorry, that is not correct. Please try again.") =20 user_answer =3D gets.chomp!.to_i end score +=3D 1 number_of_questions +=3D 1 question +=3D 1 puts("Well done! That is correct.\nYou have answered #{score} out of = #{number_of_questions} questions correctly.") end exit =3D=3D=3Dscript extract ends=3D=3D=3D Cheers, Hayden ------=_NextPart_000_0113_01C8B149.E77850D0--