“Nested If ... else déclaration” Réponses codées

Nested If ... else déclaration

var number = 5
// outer if statement
if (number >= 0) {

  // inner if statement
  if (number == 0) {
      print("Number is 0")
  }

  // inner else statement
  else {
      print("Number is positive");
  }
}

// outer else statement
else {
    print("Number is negative");
}
SAMER SAEID

Nested If ... else déclaration

using System;
 
namespace Conditional
{
	class Nested
	{
		public static void Main(string[] args)
		{
			int first = 7, second = -23, third = 13;
			if (first > second)
			{
				if (firstNumber > third)
				{
					Console.WriteLine("{0} is the largest", first);
				}
				else
				{
					Console.WriteLine("{0} is the largest", third);
				}
			}
			else
			{
				if (second > third)
				{
					Console.WriteLine("{0} is the largest", second);
				}
				else
				{
					Console.WriteLine("{0} is the largest", third);
				}
			}
		}
	}
}
SAMER SAEID

Réponses similaires à “Nested If ... else déclaration”

Questions similaires à “Nested If ... else déclaration”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code