I confess I don’t know a lot of the technical stuff about class Fixnum,
as I’ve not really needed to until now.
You should take a little time and learn a bit more detail about numbers
in Ruby. Expanding your knowledge about strings and the String class
would also be a good idea so that you understand how the classes differ.
Currently I am getting the value of ‘pop’ from the user with the
puts “please enter a population size”
pop = gets.chomp
The gets method returns a String. The chomp method is a method for
String instances that also returns a String. If the String represents a
number, such as “1234”, then you can convert that into a Fixnum or
related number type by calling to_i on the String. e.g.)
the_number = pop.to_i
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.