This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Jeffrey.Lewis
over 10 years

Notes for lesson 1.2: Making Comparisons

Below is a snippet of the code I used that allowed me to advance to the next lesson.

<p>
  <?php
  (100 < 200);
  (200 > 100);
  (100 == 100);
  199 <= 200;
  201 >= 200;
  100 != 200;
  ?>
</p>
  1. Using the parenthesis does not appear to affect the code one way or another, so I’m not sure which is actually the correct method. As an experiment, I was able to save and submit the code above, as is, and move on to the next lesson.
  2. The instructions ask to make only one comparison, however I have found that you need at least two comparisons do advance to the next lesson.

Answer 520e9072548c3507d80073b0

4 votes

Permalink

Alternatively, this works

    if (6<7)
    {
    echo true;
    }
points
Submitted by Ruben
over 10 years

1 comments

yechielweb about 10 years

Thanks that helped me, I wasn’t able to pass this lesson till I used your code. Thanks

Answer 5226b85bf10c609c24001624

4 votes

Permalink

Any comparison works, be it one or many, though you must not use echo or semicolon

If you write echo you will see 1 (true) or 0 (false) in the console, but the exercise will check it internally.

Something as simple as this below will work:

<?php
  8 >= 8
?>

I did some trial and error though, as at first it didn’t seem much obvious for me.

points
Submitted by Radu Oros
over 10 years

Answer 51e4dbbf9c4e9db1ff0016af

-1 votes

Permalink

Thank you!

points
Submitted by Eduard Gertsev
over 10 years

1 comments

Robert Bennett over 10 years

Thanks a lot, this was driving me crazy.