[this section intentionally left blank]
Summing UpUnlike many other languages, there are no exceptions in the Go programming language.
This post was inspired by the much lengthier Python Exceptions: An Introduction.
%Nmakes it work within a function;
:amakes the path absolute.
man zshgoing on instead of
Game, and the underlying type was a slice of slice of ints (
Game and int have identical underlying types (int), as follows from the definition of types:A value x is assignable to a variable of type T ("x is assignable to T") in any of these cases:
- x's type is identical to T.
- x's type V and T have identical underlying types and at least one of V or T is not a named type.
- T is an interface type and x implements T.
- x is a bidirectional channel value, T is a channel type, x's type V and T have identical element types, and at least one of V or T is not a named type.
- x is the predeclared identifier nil and T is a pointer, function, slice, map, channel, or interface type.
- x is an untyped constant representable by a value of type T.
Each type T has an underlying type: If T is one of the predeclared boolean, numeric, or string types, or a type literal, the corresponding underlying type is T itself. Otherwise, T's underlying type is the underlying type of the type to which T refers in its type declaration.And int is not a named type, thus satisfying the assignability rule.