 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 395 of 3366
 
 
			
			3K+ Views
Golang is a powerful programming language that has gained a lot of popularity in recent years. It offers many features and tools that make it easier for developers to create efficient and reliable applications. One of the features that sets Golang apart from other programming languages is the fallthrough keyword. In this article, we will take a look at how you can use the fallthrough keyword in your Golang programs. What is the Fallthrough Keyword in Golang? In Golang, the fallthrough keyword is used in switch statements to transfer control to the next case statement. When a case statement contains ... Read More
 
 
			
			296 Views
In Go, the switch statement can also be used with floating-point numbers. This feature can be useful in certain scenarios, where a floating-point value needs to be compared against different thresholds or ranges. In this article, we will go through an example program that demonstrates the use of switch statement on floating-point numbers. Syntax of Switch Statement with Float The syntax of switch statement with floating-point numbers is the same as that with any other type. The only difference is that the cases need to be specified as floating-point values. switch expression { case value1: ... Read More
 
 
			
			157 Views
When working with slices in Golang, it's common to need to remove duplicate elements from the slice. While there are many ways to do this, one approach that can be particularly useful is to remove duplicates while ignoring the order of the elements. This can be useful, for example, when you want to compare two slices for equality without caring about the order of the elements. In this article, we'll explore a simple Golang program that removes duplicates from a slice while ignoring the order of the elements. We'll break down the program step by step to explain how it ... Read More
 
 
			
			199 Views
Removing duplicates from a slice or an array is a common problem in programming. One of the ways to solve this problem in Golang is by using nested loops. In this article, we will write a Golang program that removes duplicates from a slice using nested loops. Understanding the Problem Before writing the program, let's understand the problem statement. Suppose we have a slice with some duplicate elements − numbers := []int{1, 2, 3, 1, 4, 2, 5} Our task is to remove the duplicate elements from this slice and get the unique elements. The final slice should look ... Read More
 
 
			
			2K+ Views
Golang allows us to use pointers to access the value of an object in memory. Using pointers can improve the performance of the code by reducing the memory allocation and enhancing the efficiency of the program. In this article, we will explore how to use a pointer to an array as a function argument in Golang. Pointer to an Array in Golang In Golang, an array is a fixed-length data structure that stores a collection of elements of the same type. When we pass an array to a function as an argument, a copy of the array is created, and ... Read More
 
 
			
			487 Views
In Golang, it is often required to split a slice of bytes after a specific separator. This can be done using the built-in function bytes.SplitAfter(). This function splits a slice of bytes into sub-slices after each occurrence of a specified separator. In this article, we will discuss how to split a slice of bytes after a specific separator in Golang. Syntax of bytes.SplitAfter() The syntax of the bytes.SplitAfter() function is − func SplitAfter(s, sep []byte) [][]byte where s is the slice of bytes to be split, and sep is the separator. Example package main import ( ... Read More
 
 
			
			236 Views
Slices are an essential feature of Go programming language that allows you to store and manipulate an ordered collection of elements. Slices are similar to arrays, but unlike arrays, they are dynamic and can be resized. In Go, you can perform a search operation on a slice to find an element or a set of elements. This article will guide you through the process of searching for an element of int type in a slice of ints in Go. Searching an element of int type in slice of ints in Golang To search for an element of int type in ... Read More
 
 
			
			6K+ Views
In Golang, you can replace all the string occurrences that match a regular expression with the help of the regexp package. The regexp package in Golang provides a ReplaceAllString() function that replaces all occurrences of the matched string with a new string. Example Here's an example of how to replace all the string occurrences that match a regular expression in Golang − package main import ( "fmt" "regexp" ) func main() { str := "The quick brown fox jumps over the lazy dog" re := regexp.MustCompile("fox|dog") ... Read More
 
 
			
			3K+ Views
Polymorphism is a powerful concept in object-oriented programming that allows you to write flexible and reusable code. In Go, you can achieve polymorphism using interfaces. An interface is a collection of method signatures that any type can implement. This means that you can write code that can work with any type that implements an interface, without knowing the underlying type. In this article, we will discuss how to achieve polymorphism using interfaces in Golang. What is Polymorphism? Polymorphism is the ability of an object to take on many forms. In object-oriented programming, polymorphism is achieved when an object can be ... Read More
 
 
			
			1K+ Views
Golang offers many built-in functions and packages to perform string operations. One common operation is finding the index of a particular rune in the string. In this article, we will explore how to find the index of a rune in a string in Golang. Rune in Golang is an alias for int32 and represents a Unicode code point. Each character in a string is a rune. The string package in Golang provides several functions for handling runes in a string. Let's take a look at how to find the index of a rune in a string in Golang. Using the ... Read More