Hi
My code
package main import ( "fmt" ) func main() { c := false c = c || doWork(1) c = c || doWork(2) c = c || doWork(3) fmt.Print(c) } func doWork(a int) bool { fmt.Printf("doWork %v\n", a) return true }
Result
doWork 1 true
I expect to see
doWork 1 doWork 2 doWork 3 true
Please tell me what is wrong?
In first_condition || second_condition , if the first condition is true, the second condition will not be called.
Thank you
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.