WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Go - if statement


if announcement consists of a boolean expression accompanied via one or more statements.

Syntax

syntax of an if announcement in Go programming language is

if(boolean_expression) 
   /* announcement(s) will execute if the boolean expression is true */

Example

package deal important

import "fmt"

func essential() 
   /* nearby variable definition */
   var a int = five
 
   /* take a look at the boolean situation using if announcement */
   if( a < 10 ) 
      /* if situation is real then print the subsequent */
      fmt.Printf("a is much less than 10n" )
   
   fmt.Printf("value of a is : %dn", a)

Output

$cross run essential.Go
a is much less than 10
price of a is : five