Created
December 14, 2014 15:12
-
-
Save meson10/6a28b77e8d01fa0699b1 to your computer and use it in GitHub Desktop.
types in go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type myInt int | |
const unTypedC = 20 | |
const typedC int = 30 | |
func main() { | |
var typedInt int | |
var c myInt | |
typedInt = 10 | |
impliedInt := 40 | |
c = 20 | |
impliedInt = c //Won't Work | |
c = typedInt //Won't work | |
c = unTypedC | |
c = typedC // Won't work | |
fmt.Println(c, typedInt, impliedInt) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment