The Println() function in GoLang

Printing data to the console is an essential task that not only helps debug the code but makes us write good code. In this post, we are going to take a look at the Println() function in GoLang, which is a variadic function. GoLang Println() Method Signature The method signature of the Println function is …

The Println() function in GoLang Read More »

String formatting in GoLang

String formatting is essential when we need to create a string dynamically. String formatting makes our lives easier by allowing us to do things that can take much longer if done some other way. For example, we need to print a hex value of a number. Using string formatting it is a lot easier. In …

String formatting in GoLang Read More »

Comparing Strings in GoLang

Comparing strings together is an important task that is almost unavoidable in large programs. In this post, we will see different ways of comparing strings in GoLang. 1. Using the GoLang Comparison Operators There is a multitude of comparison operators in Go. Each operator works in the way it looks. We will see what are …

Comparing Strings in GoLang Read More »

The ternary operator in GoLang

In most of the programming languages, there is an operator (?:) called ternary operator which evaluates like an if-else chain will do. But, Go does not have a ternary operator. In this post, we will dive into why it is absent in Go. What is the ternary operator? The ternary operator is the ?: operator …

The ternary operator in GoLang Read More »

The while loop in GoLang

The while loop is a very important construct in general programming. But in Go, there is no loop called while. There are only for-loops. The while loops can be emulated using the for-loops in Go. So, here are some examples of how it can be done. How to construct while loop in GoLang? The while …

The while loop in GoLang Read More »

The for-loop in GoLang

Loops are an essential part of any programming language. It does a single task multiple times. In this post, we will be diving deeper with the for loops in Go. The for-loop syntax The for loop is one of the most common loops in programming. Almost every language has it. The for loop in Go …

The for-loop in GoLang Read More »

The switch statement in GoLang

The switch statement is one of the most important control flow in programming. It improves on the if-else chain in some cases. Thus making it substantially easy to do the same task with much less code. In this post, we will see how we can use the switch statement in the Go programming language. What …

The switch statement in GoLang Read More »