@@ -19,6 +19,12 @@ func main() {
|
||||
fmt.Println("8 is divisible by 4")
|
||||
}
|
||||
|
||||
// Logical operators like `&&` and `||` are often
|
||||
// useful in conditions.
|
||||
if 7%2 == 0 || 8%2 == 0 {
|
||||
fmt.Println("either 8 or 7 are even")
|
||||
}
|
||||
|
||||
// A statement can precede conditionals; any variables
|
||||
// declared in this statement are available in the current
|
||||
// and all subsequent branches.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
d6a962236fc1296684cd1ffb2d95d131ed84abde
|
||||
U7xcpdutgCJ
|
||||
152124e287cd55e549bc29bcb8693bf260d1b3ab
|
||||
hTOHdmUcUxz
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
$ go run if-else.go
|
||||
7 is odd
|
||||
8 is divisible by 4
|
||||
either 7 or 8 are even
|
||||
9 has 1 digit
|
||||
|
||||
# There is no [ternary if](https://en.wikipedia.org/wiki/%3F:)
|
||||
|
||||
Reference in New Issue
Block a user