Bug? in Modifying Array Elements


#1


https://www.codecademy.com/courses/web-beginner-en-8a35h/0/6?curriculum_id=5124ef4c78d510dd89003eb8#


I got this error all the time: Oops, try again. It looks like you didn't print 'Advanced C ' (the element you modified)!

But that's the item I'm modifying, so I don't know why I get this error...

I hope someone can help me with this, because it's a bit frustrated...


<html>
  <head>
    <title>Modifying Elements</title>
  </head>
  <body>
    <p>
      <?php
        $languages = array("HTML/CSS",
        "JavaScript", "PHP", "Python", "Ruby");
        $languages{1} = "Advanced C" ;
        echo $languages[1] ;
        // Write the code to modify
        // the $languages array!
        
      ?>
    </p>
  </body>
</html>


#2

I found the error, reading previous posts of errors.

It only works if you choose as new language "C++"


#3

Hi @humbertova,

If you have time, go back and try your "Advanced C" again, but this time close up the extra spaces that you have left just before your ;.


#4

I just did what you told me and now if works with the word "Advanced C";

I'm going to try to use the semicolons without any space between the text and the ";" but I'm not sure this is a rule.

Sometimes the interpreter just freezes and I don't understand why.

Anyway, thanks for answering because I was saying something wrong. It works also with some other words different from "C++"


#5

I don't think it is a rule in real life coding but more a matter of what exactly this code checker is looking to find. I think it looks better without the space though. :slight_smile:


#6

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