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 Java Objects Creating the MVP Scrabble Tiles

Why do I get this particular "unreachable statement" error?

It seems like the error has to do with my line of code containing the boolean variable "Notile".

Any help in finding a solution to this problem is greatly appreciated. Thank you in advance. :-)

2 Answers

To solve the challenge, I deleted the return value of false and replaced it with this: return.tiles.indexOf(tile) != -1;

Steven Parker
Steven Parker
231,248 Points

But we didn't see what you were deleting it from.

Steven Parker
Steven Parker
231,248 Points

You'd need to show your code to make a precise answer possible, but one way to cause an "unreachable statement" error in a function (or method) is to have statement(s) after a "return" statement.

Steven, Thank you so much. I really appreciate your help. Luckily, I found the solution to complete the challenge while reading a 2 year old post regarding the same code challenge. :-)

Steven Parker
Steven Parker
231,248 Points

Did I guess it? And yes, there's quite a wealth of information in the archives. Good job discovering it. :+1: