Hi developers! I am self-studying Go (Golang). Could you please give me some advice on how to fully understand functions? Also, where can I find practice problems on this topic?
Additionally, could you provide a roadmap for learning backend development using the Gin library? My goal is to get a job as quickly as possible to earn money for my university tuition. Any advice you share will be incredibly helpful to me!
Try Python Tutor to see running line by line, or try use debugger to understand functions.
Maybe can help this small piece of code
``` #include <stdio.h> // This call a lib with function printf
// in Go you don’t need this lib, because print it is inside standard.
// This is MyFunction and return a int
int MyFunction(int x) {
// Now we are inside this block of code, only to organize
return x;
}
// main it is the heart, all begins here
int main() {
printf(“let’s start the code”);
// Now to organize all code, I separate some code inside a group of code,
// and call as MyFunction
MyFunction(2); // Now you are inside this function
Hi Once you’re comfortable with Go syntax and data types (strings/runes, slices vs arrays, maps, structs), functions start to make more sense because you understand what you’re passing around.
Focus on:
* named vs unnamed returns
* functions that take/return other functions
* methods vs functions (methods attach to structs)
* pointers in function params (when you need to modify data)