can someone explain what this line means

next if i % 2 == 1

I got it right in the exercise but I don't understand what it is telling ruby to do

# 9. Next!

**ammdhillon**#2

It means that ruby would skip the numbers that are divisible to 2 and leave "1" as a remainder. 3, 5, 7, 9 are dividable by 2 and would leave 1 as a remainder.

So, if you 1,2,3,4,5,6 and apply your code on this array, the answer would be 2,4,6.

Random

@ammdhillon,

Depending on the programming-language the **%** operator

is called the **modulo** or **remainder** operator.

the so-called **Remainder**-*operator* %

or **modulo**-*operator*

if used it will **return** the **rest-value**.

**9%3** You read it as nine modulo three is **zero**, as 9 divided by 3 has **NO rest-value**.**22%6** You read 22 modulo six is **4**, as 22 divided by 6 will leave you with **rest-value 4****10%5** You read 10 nodulo five is **zero**, as 10 divided by 5 will have **NO rest-value**

Now if you setup a *comparison* like

number %2 === 0

which you read as

number modulo two equals zero

and this results in a True

you will know that =number= is an EVEN number.....

http://stackoverflow.com/questions/3517238/what-does-the-operator-do-in-ruby-in-n-2

**ammdhillon**#4

I meant the same but I was being as modest as I could for his better understanding.

And I also know it's called modulo

But Thanx for the detail though.

**math737**#5

supersaiyangods I agree it doesn't make sense, in the instructions % seems to be compared to /

**math737**#6

maybe it means, in plain english and basic math = if it is divisible by 2 and gives only whole numbers (that's what the 1 may stand for) than it is skipped (even numbers don't give decimals a.k.a remainders during division by 2)

simililarily... the i % 2 == 0 meant that "if when i is divided by 2 and DOESN'T give only whole number (symbolized by zero) then it is skipped ( clearly the odd numbers would give answers with decimals aka remainders)

I think I deserve a gold star or a munch of likes for this simplification of % symbol