[Gambas-user] ask username his age

Tobias Boege taboege at gmail.com
Sun May 20 17:07:36 CEST 2018


On Sun, 20 May 2018, Roberto Estevam wrote:
> Greetings,
> I'm working in text mode with print, how do I get the user to type his age?
> 
> python way:
> age = int(input("what is your age: "))
> 
> How I can do the same thing in Gambas? I search in wiki but not get the
> point.
> Thank you.

I may be a bit rusty with command-line interactive programs in Gambas,
but this is what I came up with:

  Dim iAge As Integer

  Print "How old are you:";;
  Flush
  Input iAge

Flush is needed to flush the output buffer because the Print statement
does not send a newline. Without it, you won't see the prompt in the
terminal.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list