Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Ryan Maneo4,342 Points
While loops can have let after them to check for errors too? Omitted knowledge... Loops can be coupled with a try statement? Omitted knowledge. Where is the readFile function? Omitted knowledge. Someone please clarify and fill me in... I feel so confused all of a sudden!
Code I'm talking about: http://i.imgur.com/ld7PiUn.png
That definitely isn't omitted knowledge. In the code you're referring to, he's simply calling the file.readLine() method, which from this context seems to return a boolean value depending on whether there are more lines. The reason he is assigning it to a constant is because it allows him to access the result of the function inside the while loop. While he didn't explicitly mention any of this in the video, it's common sense that you can use what is returned from a method in a while loop as the boolean value.
The readLine method doesn't need to be explicitly mentioned - it's coupled with the file class for use with files. We aren't specifically working with files in anything we are doing, and he used this purely as an example, which is why he didn't feel the need to dive further into the information.