Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

Go if...else statement in Golang

package main
import "fmt"

func main() {
  number := 10

  // checks if number is greater than 0
  if number > 0 {
    fmt.Printf("%d is a positive number
", number)
  } else {
    fmt.Printf("%d is a negative number
", number)
  }
}
Source by yourbasic.org #
 
PREVIOUS NEXT
Tagged: #Go #statement #Golang
ADD COMMENT
Topic
Name
5+8 =