cs11dotnet7/vscode/Chapter03/Ch03Ex02LoopsAndOverflow/Program.cs

16 lines
206 B
C#
Raw Normal View History

2022-02-18 13:13:25 +01:00
checked
{
try
{
int max = 500;
for (byte i = 0; i < max; i++)
{
WriteLine(i);
}
}
catch (OverflowException ex)
{
WriteLine($"{ex.GetType()} says {ex.Message}");
}
}