~kotrunga/a-tour-of-go

fd938c57659714f5466e7c294cd5875e2778a41b — coltonhurst 1 year, 6 months ago f799a45
Added the type inference example.
1 files changed, 17 insertions(+), 0 deletions(-)

A basics/packages-variables-functions/1.1.14_type-inference.go
A basics/packages-variables-functions/1.1.14_type-inference.go => basics/packages-variables-functions/1.1.14_type-inference.go +17 -0
@@ 0,0 1,17 @@
/*
	Notes 1.1.14

	- In Go, if you don't specify a type explicitly when delcaring a variable,
	  the type will be inferred.
	- If the variable's initialization value is an untyped numeric constant,
	  the new variable may be an int, float64, or complex128 depending on the precision.
*/

package main

import "fmt"

func main() {
	v := 42 // change this (example values: 42, 3.142, 0.867 + 0.5i)
	fmt.Printf("v is of type %T\n", v)
}