Question: Why am I getting false for the following code?

```
def test(s)
   tester = s.split(//)
   for char in tester
       if char != 1 or char != 0
          return false
       end  
   end
   return true
end 

puts test("11111000")
# => false

```

Thank you in advance for your answer!

Answer: 
What you're doing here is full of simple mistakes, assumptions probably brought over from other languages.

The `for` statement is hardly ever used. Instead you just iterate:

```
tester.each do |char|
  # ...
end

```

Secondly, strings and numbers are not equivalent and are never automatically converted. You must be explicit:

```
if (char == '1' or char == '0')
  # ...
end

```

Also you've got a logical error, where you're testing the wrong way. Those two conditions can never occur simultaneously since there's no character that will pass both tests. Anything that passes one automatically fails the other.

What you want instead:

```
unless (char == '1' or char == '0')
  # ...
end

```

In the end, though, if you're just testing to see if this string contains exclusively `1` or `0` then just use a simple regular expression:

```
def test(s)
  !!s.match(/\A[01]*\z/)
end

```

The `!!` double negative is to convert a potential regular expression match into a simple `true` or `false` value. That's all you need. `\A` and `\z` are used to define the "beginning" and "end" of the string respectively. If you're not familiar with regular expressions you should spend some time learning about them because they are extremely powerful and perform these tasks very simply.
If you are trying to check that a string is made up of ONLY 1s and 0s, you can just do:

```
def test(s)
 s.scan(/[^0-1]/).length == 0
end 

puts test("11111000") # => true
puts test("1234") # => false
puts test("234") # => false

```