Skip to content

Instantly share code, notes, and snippets.

@Sirpyerre
Created November 2, 2022 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sirpyerre/e9f27615486ac9a732841038a3ef64c9 to your computer and use it in GitHub Desktop.
Save Sirpyerre/e9f27615486ac9a732841038a3ef64c9 to your computer and use it in GitHub Desktop.
Go if/else
package main
import (
"fmt"
)
func main() {
elegible := true
hasCredit := false
message := ""
if elegible {
if hasCredit {
message = "Can use the credit"
} else {
message = "Not enough credit"
}
} else {
message = "Not elegible to buy"
}
fmt.Println(message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment