All variables must have declarations, using var keyword. Datatypes such as integer, floating points and strings are applicable in Go as well. Note that floating point uses different hardware than the others.
Places in the code where a variable can be accessed. In Go, variable scope is managed through ‘blocks’, they are hierarchical and explicit. But you also have implicit blocks. For example.
Lexical scoping in Go, refers to the ordering of blocks, so that biggest block is the universe (just like other languages 🙄 )
Deleting the memory space occupied by a variable should be done in a timely manner (right after the variable has been used) for optimal performance, either by stack or heap. Manual deallocation us fast when you you malloc but error prone, like in C :laugh: . In Go, its automatic!
Garbage Collection is done by interpreter after all references are gone for a particular variable. In Go, garbage collection is built in even though its a compiled language. Therefore, its easy (for the programmer)! The Go compiler decides whether to assign the memory in the heap or stack in the background of the program. But the trade off is in time, and could be a performance set back.