We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Go Is Statically Typed

Go enforces static typing meaning variable types are known before the code runs. That means your editor and the compiler can display type errors before the code is ever run, making development easier and faster.

Contrast this with most dynamically typed languages like JavaScript and Python... Dynamic typing often leads to subtle bugs that are hard to detect. The code must be run to catch syntax and type errors. (sometimes in production if you're unlucky 😨)

Languages also have strong or weak typing, meaning stricter or weaker type checking rules.

Concatenating Strings

Two strings can be concatenated with the + operator. But the compiler will not allow you to concatenate a string variable with an int or a float64.

Assignment

Textio uses basic authentication to log users in.

The code on the right has a type error. Change the assignment statement on line 7 to use a string value for password instead of an integer (but don't use a different password) so that it can be concatenated with the username variable.