loading...

re: Dave Cheney #golang pop quiz VIEW POST

FULL DISCUSSION
 

Thanks, got to know that "true" and "false" can be a variable name or label. Here is another version.

package main

import (
    "fmt"
)

func isEven(v int) bool {
    false := !true

    if (v % 2) == 1 {
        goto true
    }
    return true
true:
    return false

}

func main() {
    fmt.Println(isEven(2020))
}

 

Some comments have been hidden by the post's author - find out more

code of conduct - report abuse