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