Input / Output

All computer programs have some way to give and/or receive information from the user. When you type a paper in a word processor or enter numbers in a spreadsheet, you are giving the program information.

When you go to a website using a program called a web browser, the data and information is the text and images of the webpage.

Output is when a program gives the user data or information.
Input is when a program receives data or information from the user.

In JUDO, you give the user output by using the following functions:

To receive input from the user, use these functions:

Here is an example programs using some of the above functions:

void main() {
   String name;
   int age;
   printLine("Type your name and press enter");
   name = readString();
   printLine("Hello " + name + ".  Now enter your age");
   age = readInt();
   printLine(name + " you are " + age + " years old");

readString() is used to assign a String value to a String variable.
readInt() is used to assign an int value to an int variable.

printLine() prints the value or variable you put between the parenthesis and goes onto a new line
print() prints the value or variable you put between the parenthesis and does not go onto a new line.

In the program above, you can see that Strings can be joined with String variables or other types of variables to make a longer string by using a plus sign (+). This is useful when you want to print something out to the user that includes the value of a variable.

Making a graphics program like you have already seen how to do is another example of a program that does output. The output is the shapes and colors that you display to the user.

If you use input or output functions in a program, be sure to set the Program Properties to use either a "Text" Window Style, or a "Text and Graphics" Window Style before you run the program.

You can view the Input/Output functions in the JUDO Functions Reference.

Back to Graphics     Forward to Conditionals