I’m starting to program in linux more often now and I’m starting on
linux
(Ubuntu). I’m using Kdevelop and I cannot get the program to run and
take a
gets statement meaning I cannot get user input. any advice would be very
helpful
Please post your source code and I wil take a stab at why you cant get
it to
run. I develop in kdevelop also.
I’m using Kdevelop and I cannot get the program to run and
take a gets statement meaning I cannot get user input.
You could try it simpler, just any editor that does not annoy you,
i.e. nano or bluefish. Save your .rb file, inside it something like:
puts ‘Enter input now please:’
user_input = gets.chomp
case user_input
when ‘q’
puts ‘bye!’
exit
when ‘hi’
puts ‘Hi there, lets code more’
else
puts ‘Input ‘+user_input+’ was unknown to me.’
end
And if you saved it like named “foobar.rb”, do
ruby foobar.rb
It should wait for your user input.