Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

03-types should cover declarations #13

Open
stellentus opened this issue Feb 22, 2017 · 2 comments
Open

03-types should cover declarations #13

stellentus opened this issue Feb 22, 2017 · 2 comments

Comments

@stellentus
Copy link
Contributor

var id type = val
id := val

Examples:
var num int = 16
var num int Now num has the zero value
num := 16
num := int64(16) Now num is an int64 instead of an int. Note the syntax is similar to calling a function called int64 with the argument 16.

@stellentus
Copy link
Contributor Author

stellentus commented Feb 22, 2017

Also
var num = 16 Note the type is inferred

@stellentus
Copy link
Contributor Author

Take a look at the "Explicit type conversions" slide in 09-struct.slide. I think some of that should show up in this talk, since the students have needed to do some type conversions already.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant