diff --git a/documents/Powerof10Guide.md b/documents/Powerof10Guide.md index 35f2557..07251d8 100644 --- a/documents/Powerof10Guide.md +++ b/documents/Powerof10Guide.md @@ -1,6 +1,8 @@ # NASA-style Programming for C# -I asked the AI to write their instructions in the form of guidelines. I figured I'd use C# since it's both my preferred language and the syntax should be fairly easy to grasp once you understand the basics. My only request was to apply .NET 6's [top-level statements](https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/top-level-statements) for brevity. Aside from that, it all works flawlessly. +I asked the AI to write their instructions in the form of guidelines. I figured I'd use C# since it's both my preferred language and the syntax should be fairly easy to grasp once you understand the basics. + +My only request was to apply .NET 6's [top-level statements](https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/top-level-statements) for brevity. Aside from a few organizational tweaks with the guidelines and fixing the scope example to be wrapped in a class, it all works flawlessly. ## 1. Write Clear, Well-Structured, and Maintainable Code @@ -88,18 +90,22 @@ using (var reader = new StreamReader("example.txt")) **Example:** ```csharp -void Main() -{ - int a = 5, b = 3; - Console.WriteLine($"Sum: {Add(a, b)}"); +namespace Application; - // 'a' and 'b' are limited to Main method scope -} - -int Add(int a, int b) +class Program { - // 'a' and 'b' are limited to Add method scope - return a + b; + static void Main() + { + // 'a' and 'b' are limited to Main method scope + int a = 5, b = 3; + Console.WriteLine($"Sum: {Add(a, b)}"); + } + + static int Add(int a, int b) + { + // 'a' and 'b' are limited to Add method scope + return a + b; + } } ```