WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Go - if...else statement


if declaration can be accompanied by means of an optionally available else assertion

Syntax

syntax of an if...Else declaration in Go programming language is
if(boolean_expression) 
   /* declaration(s) will execute if the boolean expression is proper */
 else 
   /* statement(s) will execute if the boolean expression is false */

Example

bundle fundamental

import "fmt"

func important() 
   /* neighborhood variable definition */
   var a int = 100;
 
   /* check the boolean circumstance */
   if( a < 10 ) 
      /* if circumstance is genuine then print the following */
      fmt.Printf("a is less than 10n" );
    else 
      /* if situation is false then print the subsequent */
      fmt.Printf("a isn't always much less than 10n" );
   
   fmt.Printf("value of a is : %dn", a);
When the above code is compiled and done, it produces the subsequent result
$move run most important.Pass
a is not much less than 10
value of a is : 100