This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Conditionals and Control Flow Forum

View Course » View Exercise

2376 points
908b897d82ea135a5627b41dc8fdb14b?s=140&d=retro
Submitted by
Vaneet Mehta
almost 4 years ago

Semicolon?

So it said to "Go ahead and write a comparison that is true.", so I wrote 8 > 2 between the php tag. So the final code was:

<?php
        8 > 2;  
      ?>

But it didn't work. It only worked when I removed the semi-colon. Is that ok?


4 votes

permalink

Hi, if you put the comparison on the same line as the '<?php>' it should work... it did for me anyhow...

<? php 8>6;
?>

Should do the trick...

926 points
52a2e07c631fe989e0007b15_418475655
Submitted by
Paul George Cook
about 3 years ago

2 Comments

908b897d82ea135a5627b41dc8fdb14b?s=140&d=retro Vaneet Mehta about 3 years ago

Hmmm interesting. I shall try. Sounds a little broken though.

55c96525e39efe607a000784_727349661 Tr0j4n V1ru5 Coding almost 2 years ago

Thx Bro!


3 votes

permalink

I'm having the same problem.

Moving along by removing the semicolon though.

524 points
52337935f10c60f245001610_576003251
Submitted by
E Narcisse
almost 4 years ago


3 votes

permalink

The issue here isn't the semi-colon. For some reason, if you have a single line with a > in it, the code is seen as invalid. Most likely this is due to some regular expression usage incorrectly thinking the > sign denotes the end of the PHP tag. If you convert this to !=, it shall work. Or do as Adam above me said, and use two > tags.

918 points
Picture
Submitted by
Travis Weston
about 3 years ago

1 Comment

Picture Travis Weston about 3 years ago

I've submitted a proper bug report about this. Hopefully it's taken care of.


2 votes

permalink

I think the semi-colon denotes the end of a code without it, it probably expect more codes that's how I understand is

630 points
436bd015e5aec2ef07d87ad445661f9a?s=140&d=retro
Submitted by
maxwell ochieng ojwang
almost 4 years ago

6 Comments

523778aa80ff3382be000dc2_818827240 monte_cristo almost 4 years ago

<?php if (8 > 2) {
echo 8;
}

?>

908b897d82ea135a5627b41dc8fdb14b?s=140&d=retro Vaneet Mehta almost 4 years ago

But, at this point, it didn't ask us to make an if statement. It asks to write a comparison that is true. I know how to make an if statement, but I was trying to do the task given.

51c26a3e7c82ca8fc500183d_404478834 SweetHeartGirl almost 4 years ago

Same problem here. It won't work with a semicolon.

538e70fd548c353425004d65_238037588 LegoLotRgeek111 over 3 years ago

I can't get mine to work with or without the semicolon. <?php
7 > 4;
?>

538e70fd548c353425004d65_238037588 LegoLotRgeek111 over 3 years ago

I just got mine to work, actually. I had to refresh the page.

7b07175a8aa3cbc0f7e3831329b7f7b3?s=140&d=retro JSMorrow over 2 years ago

I have done it with/without a semi-colon and refreshing the page. It just won't work. I think exercise 3 did something similar. The whole PHP lesson has been buggy as crap.


2 votes

permalink

Me too, not a good start to the course - obviously an error.

937 points
Picture
Submitted by
Terry Mitchell
over 3 years ago


2 votes

permalink

So basically there has been no answer or fix for this problem? I had the same problem.

232 points
52f3ed72282ae336c90015fe_67708965
Submitted by
Michael Deloney
over 3 years ago


2 votes

permalink

  <?php
        6 < 7;
  ?>

932 points
Picture
Submitted by
Supper Short
almost 3 years ago


1 vote

permalink

I just compared two pairs and it's worked.

2>1;
1>0;

743 points
539306fc282ae32776000c05_742926211
Submitted by
Adam Szczyrba
about 3 years ago


0 votes

permalink

I don't think that there is a bug.

You should ensure the operation is true.

(e.g.5 < 2; would return False).

I think the error messaging should be amended to be clearer.

1231 points
5339a96ba147962895179c94bbdeffba?s=140&d=retro
Submitted by
Mag Magusson
about 2 years ago


0 votes

permalink

there's a mistake in the example, make sure you include the 'echo' command, otherwise it won't understand what you want to do. That said, my code is correct and double checked by a tech guy i know but still won't work. I think there is a bug in the site /: good luck. apparently it is fine in firefox if you have it :)

272 points
F1371d04b120c716eb15381ce53ab075?s=140&d=retro
Submitted by
Ciara Shrager
about 2 years ago


-1 votes

permalink

+1

65 points
Picture
Submitted by
Yuriy Shilov
over 3 years ago

1 Comment

53f638067c82cab00800016b_60161961 jmmj0103 over 2 years ago

That was very helpful.