remove number for source

This commit is contained in:
Mark McGranaghan
2012-10-07 02:00:54 -04:00
parent beaad143c4
commit 2c4dea2b8e
134 changed files with 0 additions and 0 deletions

23
src/if-else/if-else.go Normal file
View File

@@ -0,0 +1,23 @@
// ## If/Else
// If/else in go is straight-forward
package main
import "fmt"
func main() {
// If/else is straight-forward. Note that there are no
// enclosing parentheses around the condition.
// Also, there is no ternary operator (`?`) in Go.
fmt.Print("7 is ")
if 7%2 == 0 {
fmt.Println("even")
} else if 7%2 == 1 {
fmt.Println("odd")
} else {
fmt.Println("???")
}
}
// There is no ternary operator (i.e. `?`) in Go, so you'll
// need to use a full if/else even for very basic conditions.

2
src/if-else/if-else.sh Normal file
View File

@@ -0,0 +1,2 @@
$ go run if-else.go
7 is odd