Today’s Outline
Exercise
any questions?
Composite types
structures, arrays, slices, maps
Methods
they're not just for structs any more
Interfaces
Wednesday, October 21, 2009
Exercise
Any questions?
One nugget:
n0, n1 = n0+n1, n0
or for a general binary operator
n0, n1 = op(n0, n1), n0
Wednesday, October 21, 2009
Composite types
Wednesday, October 21, 2009
Arrays
Arrays are quite different from C arrays; more like
Pascal arrays. (Slices, the next topic, act a little
more like C arrays.)
var ar [3]int
declares ar to be an array of 3 integers, initially all
set to 0.
Size is part of the type.
Built in function len() reports size:
len(ar) == 3
Wednesday, October 21, 2009
- 1
- 2
前往页