menu_book Course Curriculum (Go) expand_more
Variables and Constants
Learn Variables and Constants in Go through a focused explanation, a dedicated topic-specific example, an engineering boundary, and a mastery check.
Variables and Constants is a focused Go lesson inside Go Basics. It teaches the language behavior defined by Variables and Constants, using the construct directly so its effect can be traced from input to result.
Read the example from the construct outward: identify the exact syntax or API named by the lesson, trace the values that enter it, and predict the result before running the code. The example is intentionally different from neighboring lessons so the behavior of Variables and Constants remains visible instead of being hidden inside a generic demo.
Topic-specific example
package main
import "fmt"
const taxRate = 0.15
func main() {
var subtotal float64 = 80
total := subtotal * (1 + taxRate)
fmt.Printf("%.2f\n", total)
}
For Variables and Constants, change the input that sits closest to the construct and verify the boundary case as well as the normal result.