wiki:Syotto
Last modified 9 years ago Last modified on 2008-10-01 22:35:33

Syotto

Syotto is a class which has subroutines (methods) for reading user's data input. Since demonstration 4 we use a subroutine called kysy which asks user a question and waits until the user types in a string and presses the Enter key. After pressing the key the subroutine kysy will return the value the user gave.

Introduction

Here is an illustration of the easiest way to use:

           Name of the class
           in Ali.jar
                 |            Question printed on the screen
                 |                 |
                 |                 |
String name = Syotto.kysy("Give your name");
                       |
                       |
                       |
                   Name of the subroutine
                   in the class Syotto

Syotto = Input
kysy   = ask

In this line we initialize a string variable name with the return value of the subroutine call Syotto.kysy("Give your name");.

Works with integer too:

int age = Syotto.kysyInt("Give your age");

A full example here

Note: in this case the subroutine doesn't return default value when only Enter is pressed.