Output with quotation marks with print


#1

My code below
print "What is your name?"
name = gets .chomp
print "Which state are you from (abbr.)" # the brackets is to remind people to type in abbrevation
state = get .chomp .upcase

produces results below:
What is your name?
Anna
Which state are you from?
"MN"

Why does the last output have quotations on it? instead of just MN. Thank you.

Replace this line with your code.


#2

Note the differences in your code. gets vs. get.

The latter does not differentiate between data types. When it receives inputs it sees it is string data, so adds the quotes (it casts it to string type).

get  => get any input and type cast as identified

gets => get string input, no casting required

It would be a good idea to avoid the use of white space in chained expressions.

gets.chomp.upcase