Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
32
Task/Short-circuit-evaluation/Go/short-circuit-evaluation.go
Normal file
32
Task/Short-circuit-evaluation/Go/short-circuit-evaluation.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func a(v bool) bool {
|
||||
fmt.Print("a")
|
||||
return v
|
||||
}
|
||||
|
||||
func b(v bool) bool {
|
||||
fmt.Print("b")
|
||||
return v
|
||||
}
|
||||
|
||||
func test(i, j bool) {
|
||||
fmt.Printf("Testing a(%t) && b(%t)\n", i, j)
|
||||
fmt.Print("Trace: ")
|
||||
fmt.Println("\nResult:", a(i) && b(j))
|
||||
|
||||
fmt.Printf("Testing a(%t) || b(%t)\n", i, j)
|
||||
fmt.Print("Trace: ")
|
||||
fmt.Println("\nResult:", a(i) || b(j))
|
||||
|
||||
fmt.Println("")
|
||||
}
|
||||
|
||||
func main() {
|
||||
test(false, false)
|
||||
test(false, true)
|
||||
test(true, false)
|
||||
test(true, true)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue