Billions of Booleans please help


#1



https://www.codecademy.com/courses/ruby-beginner-en-NFCZ7/3/5?curriculum_id=5059f8619189a5000201fbcb

can someone please help me figure out why this isnt working

error Oops, try again. Make sure to put an expression after each =!
and error (ruby):5: unterminated regexp meets end of file


# test_1 should be true
test_1 = (9==9) && (100==100) // true
# test_2  should be true
test_2 = (45==35) || (400==300) // true
# test_3  should be false
test_3 = !(21==21) || (6==7) // false


#2

Test 2 will result in a false. One of the conditions needs to be true before or after the OR operator || in order for the test_2 to return true. So maybe just change (45==35) to (45==45).


#3

good point I changed that like you said and still have an error. man I have been fiddling with this one for hours. any other ideas?

test_1 should be true

test_1 = (9==9) && (100==100) = true

test_2 should be true

test_2 = (45==45) || (400==300) = true

test_3 should be false

test_3 = !(21==21) // (6==7) = false


#4

This code works for me. Maybe try and refresh the page and run it again. Just incase there shouldn't be any = true or = false after the statements.

# test_1 should be true
test_1 = 1 === 1 && 5 < 8

# test_2 = should be true
test_2 = false || true

# test_3 = should be false
test_3 = !(21==21) || (6==7)

#5

thank you so much for taking the time to help me out. I will give it a try


#6

You are most welcome let me know if that solved it.


#7

that worked! I have never seen three = in a consecutive order before. What does it signify?


#8

Well it's slightly tricky.

The 3 equal signs means "equality without type coercion". Using the triple equals, the values must be equal in type as well.

0 == false   // true
0 === false  // false, because they are of a different type
1 == "1"     // true, automatic type conversion for value only
1 === "1"    // false, because they are of a different type
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false

Not the best explanation, so I suggest you have a read of this thread https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.