Syntax
if
condition {
} else {
}
If the
condition evaluates to true, then the block of statements followed by if block
are executed, else the statements followed by else block are executed.
HelloWorld.go
package main import "fmt" func main() { a := 10 if a == 10 { fmt.Println("Value of a is 10") }else { fmt.Println("Value of a is 11") } }
Output
Value of a
is 10
No comments:
Post a Comment