My Right Tool Looks Wrong


#1

So, normally when you get the go ahead you move on, but this really bothered me.

My code is below, and I noticed in the output window it had not one, but two errors, so I'm confused. Did I do the exercise correctly, or not?

evens = my_array >= % 2 == 0 ? puts "#{evens}" : nil


#2

I don't understand what exactly are you trying to do here.
Post full code please.
but what I got from your code is this:

my_array = [6, 4, 2]
evens = my_array.map do |x| x.to_i % 2 == 0 end
puts "#{evens}"


#3

This exercise: https://www.codecademy.com/en/courses/ruby-beginner-en-1o8Mb/2/1

Instructions: Let's get a little inventive. Write a loop that only puts the even values of my_array. (Bonus points if you use a one-line if!)

Then it gave me the following array to start with:

my_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]