Start from zero and write real Go programs that talk, remember, decide, repeat and keep lists.
- 28 lessons
- 7 units
- 3 h 29 m in all
- £0, for good
what’s inside.
For people who have never written a line of code. Nothing is assumed: every new word is explained the moment it appears.
Twenty-eight short lessons take you from your very first line of Go to programs with loops, slices, functions and structs. Each lesson explains one idea with everyday pictures, then has you guess, try and fix real code. You finish by building a funfair token counter that puts everything together.
every lesson goes the same way.
- meet it
- guess first
- your turn
- fix it
- nailed it
unit 1
Say hello
Make the computer do exactly what you tell it.
- What code really is5 minFind out what code is and run your very first Go program.
- Your first line7 minMeet the frame every Go program needs, then show any message you like.
- More than one line7 minShow several lines, blank lines and lots of words at once.
- When it goes wrong8 minRead error messages and fix the ones you will see most.
unit 2
Boxes with names
Make the computer remember things.
unit 3
Words and numbers
Tell text and numbers apart and use both.
- Text and numbers7 minTell Go whether a value is text, a number or a yes-or-no.
- Doing maths8 minAdd, take away, multiply, divide and share things out.
- Tricks with text7 minMeasure, shout, tidy and swap the words in a string.
- Putting values inside text8 minSlot values into sentences and turn numbers into text.
unit 4
Make decisions
Make your program choose what to do.
unit 5
Repeat yourself
Do the same thing many times without copying.
- Counting with for7 minRepeat lines a set number of times without copying them.
- Repeating while it is true8 minKeep going until something changes, however long it takes.
- Loops that decide8 minCheck every round, spot even numbers and count matches.
- Stopping early7 minLeave a loop early or skip a round you do not need.
unit 6
Slices
Keep many things together and work through them.
unit 7
Your own commands
Wrap code up so you can use it again.
- Making a function7 minWrap lines of code under one name and run them whenever you like.
- Giving it information7 minHand your function a value so it can do something new each time.
- Getting an answer back8 minMake a function hand you a result you can keep and use.
- Putting it all together9 minBundle values into a struct and build a program from small parts.