Specifics about my newline error [Ruby, Crystal]


#1

I decided to branch off my old post and address the specific Ruby error I’ve been having.

I recently switched back to Mate 18.1 Mint, and found that in Ruby whenever I read from a file, and process that file as an input prompt, there is a newline I can’t seem to figure out the evidence for in the source code.

It seems to be an OS issue, but only seems to effect Ruby:

name = File.read("config_name.txt")

print "#{name}: What is your name? >> "
my_name = gets.chomp

puts "#{name}: Hello #{my_name}, I'm your girlfriend!"

It only seems to happen in the variable that’s read from a file. Anyone else experience similar kinds of issues?

I didn’t think to ask earlier, cause I thought Ruby was dead.

Going to check to see if I have the same issue in Crystal. Nah it seems to happen in Crystal lang as well, or any language where I can read a file, and process that as a string.