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: 
It is because `char != 1 or char != 0` is always `true`. Whatever `char` is, it cannot be both `1` and `0` at the same time.

---

The following is only based on a guess regarding the purpose of the OP's code. If the purpose was to check if `s` includes nothing but `"1"` or `"0"`, then, I would do:

```
s !~ /[^01]/

```
I'm not really sure what this code is supposed to do, but you have used some constructions, that (even though they are available) would not be considered ruby-way:

* you have used `or` instead of `||` -- `or` is usually used for flow control notation, and has very low precedence
* you have used `for ... in ...` instead of iterator
* you are explicitly trying to return `true`/`false` while it can be done in cleaner way by using correct iterator.

Solution easier to read and understand would probably look more like that:

```
def test(s)
   s.split(//).any? { |char| char != 1 || char != 0 }
end 

```

Please note that there are more problems with your code (comparing strings with numbers and using condition that is always true) pointed by others.