Getting StartedGiving Commands to ObjectsPrograms 1Programs 2CalculatorVariables: Remembering StuffStrings 1Strings 2InputIfWhile: Loops and Repeating ThingsRandom Numbers and ChooseFSM: The Finite State Machine
Input

input("How are you?"); with result

If you want the computer to ask you a question, you can use the "input" command. You give the command a string with the question to be asked. A window then shows up with the question, and you must type in the answer.

answer = input("How are you?"); show(answer); name = input("What is your name?"); show("Hello, " + name);

The computer then gives the answer back to your program in a string. You can put that string into a variable and use it later. Give it a try.

thing = input("Give the name of something"); color = input("Type a color"); show("I really like eating " + thing + ", especially with peanut butter."); show("The " + color + " are best, but sometimes they are too big to fit in a sandwich.");

You can try making madlib games using input.

|

Programming Basics

Programming Basics: Beginners

E-mail | About | Privacy Policy