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 trialRichard andreasen
4,591 Pointsor statement isn't registering
the || function isn't registering in workspace it's highlighted red and when I enter jerk after compiling it and saving it it'll continue down the loop instead of exiting.
String noun = console.readLine("Enter a noun: "); if (noun.equalsIgnoreCase("dork") || noun.equalsIgnoreCase("jerk")) { console.printf("That language is not allowed. Exiting \n\n"); System.exit(0); }
Lauren Moineau
9,483 PointsThanks. It looks like you've added to the code since so it will be difficult to answer your question. Is it working now? The code as it is now in the workspace you shared runs fine on my side. The OR operator (||) is supposed to be in red, so don't worry about that. Is it possible you might have forgotten to save the file before running it (it happened to me many times)?
Richard andreasen
4,591 Pointsyeah i figured that i might not of been saved but it was and i just added the other line it doesn't work still i'll try to restart browser and comp who know it might work
Lauren Moineau
9,483 PointsYou mean you uncommented that line
// if (noun.equalsIgnoreCase("dork") || noun.equalsIgnoreCase("jerk")) {
and commented out those 3?
if (noun.equalsIgnoreCase("dork") ||
noun.equalsIgnoreCase("jerk") ||
noun.equalsIgnoreCase("nerd")) {
If so, it works fine on my side.
Lauren Moineau
9,483 PointsOK. You're welcome! I'm glad it's all working fine in the end :)
1 Answer
Richard andreasen
4,591 Pointsit works now and i only added the other line of code to follow along with the video and the reason for commenting out the code was to copy and paste a solution from prior answer and determine if my line of code butted up against the solution didn't match but it did. Weird thanks for the help though! we're up and running again
Lauren Moineau
9,483 PointsLauren Moineau
9,483 PointsHi Richard. It looks OK to me. Could you share a snapshot of your workspace here, please? (the option is at the top right corner of your workspace next to the fork option). Thanks