TL ; DR:
A name error happens when Go sees an identifier that does not exist.
Misspelling a function name causes an error:
fmt.Prntln("Hey!")Misspelling a variable name also causes an error:
var animal string = "parrot" fmt.Println(anmal)
Full lesson:
Go must know what every identifier refers to. If a function or variable name is misspelled, Go cannot compile the program.
For example, fmt.Println exists, but fmt.Prntln does not.
Variable names must match exactly too:
var weather string = "sunny"
fmt.Println(weather)
Assignment
Follow the Coding Tutorial and fix the misspelled names.
Hint
Check the function name and the variable name.
Free plan: 30 tutor messages. PRO is unlimited.
