avatar

PrintF/ScanF

Go Basics - Error as values

Error Handling in Go is bit different than traditional way you must have seen in programming in languages like JavaScript . Instead of traditional “Try/Catch” Go use something called error as values. Go, like most statically-typed languages, mandates that you define the return type of your functions. In order to understand Error handling we must first understand return types . Let’s dive in by creating a basic function, demoFunc, that accepts a string argument and returns it in all lowercase letters.

Go Basics - Map and Structs

While arrays and slices form the core of sequential data structures, maps, interfaces, and structs offer unique capabilities, especially when transitioning from a language like TypeScript. Lets talk about them today. Maps: Go’s Key-Value Store: 🔗A map in Go is a composite type that represents a hash table or a dictionary or object/map in typescript’s case. It associates keys and values where each key maps to a unique value. The key can be of any type for which the equality operation is defined, such as integers, floats, strings, etc.