• оператор if-else — очень распространенный термин в компьютерном программировании.
  • Предположим, если на улице дождь, вам нужна куртка.
  • Если пользовательское значение удовлетворяет условию, будет запущен оператор if.
  • Если пользовательское значение не удовлетворяет условию, будет запущен оператор else.

Простой пример в JAVA:

public static void main (Strings[] args)  {
int i = 3; // Store a number 3 in variable i, 'int' means Integer. 
if(i < 5) // Checking if 3 is less then 5, "here 'i' is equal to 3" 
{
  // Since 3 is less than 5, 'if statement' will run.
  System.out.println("Yes, 3 is less than 5");
  // "System" is a Keyword. 
  // ".out"  means Output. 
  // ".print" means Display a Message. 
  // "ln" means print on next line.
}
else
{
   // This 'else' statement will not Run because "3 is not less than 5".
   System.out.println("No, 3 is not less than 5");
	}
}
/*{
    HAPPY CODING :)
      }*/

Простой пример на C++:

int main()  {
int i = 3; // Store a number 3 in variable i, 'int' means Integer. 
if(i < 5) // Checking if 3 is less then 5,  "here 'i' is equal to 3" 
{
   // We all know that 3 is less then 5 so 'if statement' will Run.
   cout << "Yes, 3 is less than 5";
   // 'cout <<' means Console Output.   
 }
else
{ 
// This 'else' statement will not run because "3 is not less than             5".
   cout << "No, 3 is not less than 5";
  }
}
/*{
    HAPPY CODING :)
      }*/

Подпись к изображению:

https://www.webdevelopersnotes.com/javascript-if-else-statement