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
killian jardeleza
1,820 Pointsproblems with boolean
hello im new to coding and i have a question about how to make a conditional statement that will give me one response if i type yes and give me another response if i say anything else but yes. I know how to do this the only thing i dont know how to do is define the anything else but yes part. like how do I write if yes you get a response "good job", but if you write anything else but yes you get a response "wrong".
1 Answer
Pedro Cabral
33,586 PointsJust as you said:
if (response.equals("yes")) {
// good job
} else {
// wrong
}
killian jardeleza
1,820 Pointskillian jardeleza
1,820 Pointsthanks for the help