constants/

directory
v0.0.0-...-ae246d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2016 License: Apache-2.0

README

Constants

Constants are a way to create a named identifier whose value can never change. They also provide an incredible amount of flexibility to the language. The way constants are implemented in Go is very unique.

Notes

  • Constants are not variables.
  • They existing only at compilation.
  • Untyped constants can be implictly converted where typed constants and variables can't.
  • Think of untyped constants as having a Kind, not a Type.

https://golang.org/ref/spec#Constants
http://blog.golang.org/constants
http://www.goinggo.net/2014/04/introduction-to-numeric-constants-in-go.html

Code Review

Declare and inialize constants (Go Playground)
Parallel type system (Kind) (Go Playground)

Exercises

Exercise 1

Part A: Declare an untyped and typed constant and display their values.

Part B: Multiply two literal constants into a typed variable and display the value.

Template (Go Playground) | Answer (Go Playground)


All material is licensed under the Apache License Version 2.0, January 2004.

Directories

Path Synopsis
Sample program to show how to declare constants and their implementation in Go.
Sample program to show how to declare constants and their implementation in Go.
Sample program to show how constants do have a parallel type system.
Sample program to show how constants do have a parallel type system.
exercises
exercise1
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.
template1
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL