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.

C#

Why some line number does not have codes? How will I know if I need to leave some number line without a code?

Below is an example of what I'm talking about, as you can see line number 7 and 11 does not have any codes...so why is that?... is that necessary for coding?

1 class Program 2 { 3 static void Main() 4 { 5 // Prompt the user for minutes exercised 6 Sytem.Console.Write("Enter how many minutes you exercised: "); 7
8 // Add minutes exercised to total 9 // Display total minutes exercised 10 // Repeat until the user quits 11
12 }
13}

2 Answers

It is absolutely not required to put empty lines in your code, but adding one empty line after small blocks of code (loops, if-else clauses, methods, etc.) just helps with readability.

Thanks emmuster! :)