Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created November 7, 2022 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/316aeea05a96dfa9fb62ed4ccde6e0b9 to your computer and use it in GitHub Desktop.
Save IntegerMan/316aeea05a96dfa9fb62ed4ccde6e0b9 to your computer and use it in GitHub Desktop.
int sum = 0;
try
{
for (int i = 0; i <= myArray.Length; i++)
{
sum += myArray[i];
}
}
catch (IndexOutOfRangeException ex)
{
// Do nothing
}
Console.WriteLine("The total is " + sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment