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: 
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

```
`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

```