Selecting using the if construction
When you come to perform the actual selection you end up with code which looks a bit
like this:
int selection ;
selection = readInt ( "Window Type : ", 1, 3 ) ;
if ( selection == 1 )
{
handleCasement();
}
else
{
if ( selection == 2 )
{
handleStandard();
}
else
{
if ( selection == 3 )
{
handlePatio() ;
}
else
{
Console.WriteLine ( "Invalid number" );
}
}
}
This would work OK, but is rather clumsy. You have to write a large number of if
constructions to activate each option.