Instructions:
The Programming Toy allows you to learn programming techniques using JavaScript.
In addition the Programming Toy has three custom function to use in Toy Programs.
The function are for basic input and output from the Toy Programs.
Not not surprisingly the functions are call input(), and output()
Run the simple program x=input();output(x); to see how they work.
Load() function allows the Programming Toy to load a Program from a javascript url.
Example load("code2.js");.
-
for (i = 0; i <= 5; i++)
{
output("The number is " + i)
};
x=input();output(x);
output(Math.random());
var d6=Math.floor(Math.random()*7); output(d6);
var d6=Math.floor(Math.random()*7);
var i = 0;
do
{
alert('Pick a number between 1 and 6');
i=input();
}
while (i != d6)
alert('You got it');
var d6=Math.floor(Math.random()*7);
var i = 0;
do
{
output('Pick a number between 1 and 6');
i=input();
output('try again');
}
while (i != d6)
alert('You got it');
var d6=Math.floor(Math.random()*7);
var i = 0;
do
{
output('Pick a number between 1 and 6');
i=input();
if(i != d6){output('try again');};
}
while (i != d6)
output('You got it');
xxxxxxx