Learn Programming in Go (golang): Fun Project “Hangman” Game
- Starting a simple package in Go without fancy package management or using Go modules.
- Deal with functions from the standard library for formatted input/ouput.
- Use of primitive data types like string, bool, int and accessing elements of underlying arrays by their index.
- Work with values of type string and make use of methods provided in the package “strings” from the standard library.
- Conditional execution of external (non-Go) programs provided by your operation system.
- Design simple control flow by using for loops, if/else if/else, switch case, functions, range, aso.
- Read data from simple textfiles.
- Handling of the obvious errors and potential sources of errors.
- Pass a pointer value to a function accepting a parameter of type pointer to mutate a value.
- Add useful comments as minimal documentation to your code. (Yes, I know it could be done better!)
No experience in Go programming needed, just join watching a simple project grow to a running game.
A free IDE (Visual Studio Code) or a simple text editor, and Google’s programming language Go installed you can follow to build a programm from scratch.
Joy learning coding and see a simple programm growing in short time.
Join me on an exciting short trip as we experience a little coding project with Google’s programming language Go (golang). Together we will use the basics of programming and build the classic guessing game “Hangman” for the terminal – from scratch of course.
At the end of my latest programming course “Learn Programming in Go (golang): A Rich Guide for Beginners” I suggest my students to start using Google’s programming language Go just by creating a simple “Hangman” game for the terminal. With this simple project I redeem the promise to myself to show you how easy it is to start coding with Go.
This project doesn’t even have to show off with “fancy” features like to extensive use of slices, concurrency or complex structs that Go has to offer. Rather, I want to show how Google’s programming language can be used to achieve respectable results in the shortest possible time.
The fun of “ease of programming” is in the foreground here! So enjoy it, it’s free!
Why did Google develop a new programming language?
In Google’s words, “Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either
- efficient compilation,
- efficient execution, or
- ease of programming;
Finally, working with Go is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.”
In my humble opinion, Go is the best programming language you can learn today. I’ve worked with a few programming languages since I was introduced to programming through BASIC in the mid-80s, and Go is by far the best-designed language I’ve ever used.
Now start your computer and let’s have some fun coding “Hangman”!
Who this course is for:
- Google’s Go (golang) programmer on an absolute beginner level.
- People curious of Go’s syntax and use of the Go programming language.
- Everybody who enjoys the ease of programming Go provides.