Skip to content

Nested if

You can nest if statements inside another if.

bool hasTicket = true;
bool isVIP = false;
if (hasTicket)
{
if (isVIP)
Console.WriteLine("Welcome VIP!");
else
Console.WriteLine("Welcome regular guest.");
}
Terminal window
dotnet run
Terminal window
Welcome regular guest.