Getting User Input


This is a bit on the basics of grabbing user input from a console, using Ruby, Python and Groovy.


The command to request user input in a console is: gets
More specifically, one should use gets.chomp
chomp removes the extra lines that might come in.

Example: user_name = gets.chomp


In Python3 the command to request user input from the console is: input()

Example: user_name = input(“What is your username?”)


Groovy uses this syntax:

def username = System.console().readLines(“What is your Username?”)

Leave your vote

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

About Admin 329 Articles
I work for a Telecom company writing and testing software. My passion for writing code is expressed through this blog. It's my hope that it gives hope to any and all who are self-taught.