cs11dotnet7/vscode/Chapter03/Ch03Ex02LoopsAndOverflow/Program.cs
2022-02-18 12:13:25 +00:00

16 lines
206 B
C#

checked
{
try
{
int max = 500;
for (byte i = 0; i < max; i++)
{
WriteLine(i);
}
}
catch (OverflowException ex)
{
WriteLine($"{ex.GetType()} says {ex.Message}");
}
}