Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
namespace CommonIssues
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int num1 = 10;
|
||||
int num2 = 0; // This will cause a divide by zero issue
|
||||
|
||||
// The following line should handle the potential exception properly
|
||||
Console.WriteLine("Division Result: " + Divide(num1, num2));
|
||||
|
||||
// Unused variable
|
||||
int unusedVariable = 5;
|
||||
|
||||
// A poorly named variable
|
||||
int a = 7;
|
||||
|
||||
// An if statement that should use braces
|
||||
if (num1 > num2)
|
||||
Console.WriteLine("Num1 is greater");
|
||||
|
||||
// A method without a return type
|
||||
PrintMessage("Hello, World!, World! 12345678");
|
||||
}
|
||||
|
||||
static int Divide(int x, int y)
|
||||
{
|
||||
return x / y; // Potential divide by zero exception if y is 0
|
||||
}
|
||||
|
||||
static void PrintMessage(string message) // Should return something (or be void)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user