Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Mariano Giustozzi
Mariano Giustozzi
3,351 Points

Whats wrong with this filter? Censoring words

Hi!

My code is something like this :

String name = console.readLine("Enter a name:  ");
String adjective = console.readLine("Enter an adjective:  ");
String noun;




do {
   noun = console.readLine("Enter a noun:  ");

  if (noun.equalsIgnoreCase("Dork") || 
    noun.equalsIgnoreCase("Jerk"));{
        console.printf("That Language is not allowed, Try Again \n\n");
  }

   }while (noun.equalsIgnoreCase("Dork") || noun.equalsIgnoreCase("Jerk"));
String adverb = console.readLine("Enter an adverb:  ");
String verb = console.readLine("Enter a verb ending with -ing:  ");

The thing is that if you write a word that is not "Dork" or "Jerk" the console.printf shows up anyway.

1 Answer

Harry James
Harry James
14,780 Points

Hey Mariano,

It looks like you've put an additional semicolon on the end of your if statement, if you remove this, the challenge should pass.


Let me know if you run into any more issues :)

Mariano Giustozzi
Mariano Giustozzi
3,351 Points

that little thing was breaking my head, thanks!!