I installed byebug with the command given in the Alpha lesson and loaded primes.rb in pry and then ran prime?(5). The byebug output isn’t showing at all. Here’s the full rundown of what I ran in terminal:
Kevins-MacBook-Pro-2:r Kevin$ gem install byebug
Building native extensions. This could take a while...
Successfully installed byebug-9.0.6
Parsing documentation for byebug-9.0.6
Done installing documentation for byebug after 1 seconds
1 gem installed
Kevins-MacBook-Pro-2:r Kevin$ pry
[1] pry(main)> load 'primes.rb'
=> true
[2] pry(main)> prime?(5)
=> false
[3] pry(main)>
I installed byebug and ensured that my primes.rb file included require ‘byebug’ on top. Despite doing this, it’s not showing the byebug output it’s supposed to be showing.
what my primes.rb file looks like:
# primes.rb
require 'byebug'
def prime?(num)
(1..num).each do |idx|
if num % idx == 0
return false
end
end
end
def primes(num_primes)
ps = []
num = 1
while ps.count < num_primes
primes << num if prime?(num)
end
end
if __FILE__ == $PROGRAM_NAME
puts primes(100)
end