Basics

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

Ruby:

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

Python:

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

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

Groovy:

Groovy uses this syntax:

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

Leave a Reply

Your email address will not be published. Required fields are marked *