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]/

```
`char` is a string, so it will never equal either `1` or `0` - only `"1"` or `"0"`

This code will work:

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

puts test("11111000")
# => true
puts test("111110002")
# => false

```

a more succinct way to do the same will be

```
def test(s)
  s =~ /^[10]*$/
end

```