Hi Katherine, When I was just beginning with programming in C#, I found it very helpful to add a code comment to the line with the closing brace to indicate what it was closing. For example:
public void MyMethod(int number, bool value) { for (int i = 0; i < number; i++) { if (value) { DoSomething(); } else { DoSomethingElse(); } // end "if" } // end "for" } // end "MyMethod" Are you using Visual Studio or similar tool to write your code? "Smart" tools like Visual Studio can help keep track of this by automatically inserting braces at the right places, as opposed to writing your code in a plain text editor. On Thu, Feb 14, 2013 at 10:37 AM, Katherine Moss <katherine.m...@gordon.edu>wrote: > Hello all, > Does anyone know any methods I could use when practicing programming in C# > (I'm kind of just learning, so it can get annoying sometimes), to keep my > braces straight? I will be writing something simple, and then before I > know it, I'll have fifty errors show up all because of one brace not closed > or two braces in the wrong place. Very annoying when fifty errors come up > because of a single problem. And not only in keeping track of braces, I'm > also confused as to what goes in between braces since C# gets layered > sometimes in terms of code blocks. Books demonstrate examples well, > however, they do not do a very good job telling you where braces go to > begin with and why. Responses would be great on this. Thanks. > >