How extract count of even number and display them

Hello,
I’m totally new to Ruby and I am trying to code the following:
Print and count even numbers existing before value “N”.
Ex: If number 9 is entered, code will print : 0,2,4,6,8 and total count:
5
Any help would be appreciated!

What exactly is your question?

Luc Lucas wrote in post #1185718:

Hello,
I’m totally new to Ruby and I am trying to code the following:
Print and count even numbers existing before value “N”.
Ex: If number 9 is entered, code will print : 0,2,4,6,8 and total count:
5
Any help would be appreciated!

N=11
puts “nb=#{(N+1)/2}”
(0…N).step(2) {|x| p x}