- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1082 Articles for Go Programming
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
583 Views
In this article we will write an article to compare numbers and strings using library function in Go language. we will write two programs to illustrate. In the first program we will use the external user defined function and in the second one we will use the internal library function to implement the logic. Syntax func Compare(s1, s2 string) int Compare() function is used to compare the given strings in go. It is present in strings package. This function takes the strings to be compared as argument to the function and returns the integer equivalent after comparing the two ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
350 Views
In this tutorial, we will learn how to convert Boolean to a string in Go programming language. Boolean is a data type having 1 byte size. It can store any one of the three values mainly True, False or none. String data type is used to store a sequence of characters. Convert Boolean Variables to String using FormatBool() Functions Syntax func FormatBool(b bool) string This function is present in strconv package. FormatBool() function is used to convert a Boolean variable to string. The function takes the Boolean value as an argument and returns a string. Algorithm STEP 1 − ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
215 Views
In this tutorial, we will learn how to print hollow star triangle pattern using Go programming language. The user can specify the maximum number of rows to print as an inverted pyramid star pattern using this GO programmed. Here, we'll print the inverted Pyramid of * symbols up till the user-specified rows are reached. Algorithm STEP 1 − Import the package fmt STEP 2 − Start function main() STEP 3 − Declare and initialize the variables and assign value to them. STEP 4 − Initialize a variable to store the number of rows that star pattern should print. STEP 5 ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
380 Views
An enum combines related constants into a single type. Enums are a strong feature with many applications. However, compared to the majority of other programming languages, they are implemented very differently in Go. In this article, we'll see how to use a predeclared identifiable iota to implement enums in Golang. IOTA − Iota is an identifier that is used with constants and can make auto-increment number-based constant definitions simpler. The keyword "iota" stands for an integer constant that begins at zero. Implementing Iota package main import "fmt" const ( c0 = iota + 1 ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
2K+ Views
In this tutorial, we will see to write a go language program to search the largest element in an array. an array is a variable that is used to store elements at contiguous memory locations. We can find the largest element of an array by either using a separate function or by using for loop and if conditions in the main() function. Finding the Largest Element in an Array in Main Function() The following code illustrates how we can search and find the largest element present in an array. Algorithm STEP 1 − Import the fmt package that allows us ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
432 Views
In this tutorial, we will see to write a go language program to rotate an array. We will write two programs for this. One to rotate the array to left and another to rotate it to right. Algorithm STEP 1 − Import the fmt package that allows us to print anything on the screen. STEP 2 − Create a function named rotateLeft() which returns the final array after rotating it. STEP 3 − This function uses a for loop to iterate over the array and calls rotateLeftByOne() function in each iteration. STEP 4 − This function takes the array as ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
966 Views
In this tutorial, we will write a go language program to get the flattened 1D array from a multidimensional 2D array. A multi-dimensional array is an array of arrays, where each inner array represents a row of elements. A 1D array, on the other hand, is a single array that contains all the elements of the multi-dimensional array in a contiguous manner. Syntax func append(slice, element_1, element_2…, element_N) []T The append function is used to add values to an array slice. It takes number of arguments. The first argument is the array to which we wish to add the ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
119 Views
In this tutorial we will write an article to find the normal and trace of a matrix. A matrix is considered to be normal if its square root equals the sum of the squares of each member and trace is the total of a matrix's diagonal elements. Finding Normal of the given Matrix Algorithm STEP 1 − First we need to import the fmt and math package. STEP 2 − Create a function to find the Normal of the matrix. This function uses two for loops to find the square of each element. STEP 3 − Update the sum variable ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
1K+ Views
In this tutorial, we will write a go language program to get the sub array from an array using a specified range of indices. A subarray is a contiguous portion of an array, specified by a range of indices. For example, given the array [1, 2, 3, 4, 5] and the range of indices [1, 3], the resulting subarray would be [2, 3, 4]. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments func ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
4K+ Views
In this tutorial, we will write a go language program to add an element in the array at the beginning of an array. to add an element in the starting of an array we will use for loops and the concept of indexing in arrays. We shall now discuss these methods one by one in this program. Method 1: Using Append() Function Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments and returns the ... Read More