- 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)
385 Views
A matrix is a collection of numbers arranged in rows and columns, a two-dimensional array. Here we will use three methods to find the sum of elements and compare each method for the same using Go Programming language. Algorithm Step 1 − Import the fmt package. Step 2 − Now we need to start the main() function. Step 3 − Then we are creating a matrix naming matrix. Step 4 − Print the matrix on the screen using fmt.Println() function. Step 5 − Initialize a new variable called sum of type int to hold the resultant sum. Step ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
87 Views
What are Objects in Golang? Objects are defined on the structs and store Key-value pairs of data together in go programming. There are numerous methods for producing an object. A struct is a user-defined type that groups together a collection of fields (also known as properties or data members) and methods. A struct can be defined using the type keyword, followed by the struct name and a struct literal that defines the fields of the struct. Method 1: Using a user-defined function Algorithm Step 1 − First, we need to import the fmt package. Step 2 − Then we ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
115 Views
What is a Matrix? A matrix is a collection of numbers that are arranged in rows and columns, which is a two-dimensional array. Here we will use three examples to find the sum of elements and compare each element of the matrix for the same using the Golang program. Algorithm Step 1 − Import the fmt package. Step 2 − Now we need to start the main() function. Step 3 − Then we are creating a matrix naming matrixA. Step 4 − Print the matrix on the screen using fmt.Println() function. Step 5 − Initialize a new variable called ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
2K+ Views
What is Static Keyword in Golang? The term "static" is used to describe variables, functions, and methods that have a fixed or unchanging value or behavior. In Go, the static keyword does not exist. In go we use the term "variables" to describe the memory locations where data is stored and manipulated. Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope. Algorithm Step 1 − First, we need to import ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
114 Views
In this article, we will write a go language program to add two complex numbers by passing a class to a function. Here we will create a function to the class that will accept the class as an argument along with its properties and we can easily calculate the sum of the provided complex numbers using it. Algorithm Step 1 − First, we need to import the fmt package. Step 2 − Then, create the structure named Complex and define in it the properties real and imaginary. Step 3 − Then create a function to the complex class declared ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
100 Views
What is Boundary Elements? In go programming language. the boundary elements of a matrix are the elements that are located on the outer edge of the matrix. They are located at four positions i.e the first row, the last row, the first column and at the last column. In a matrix of size m x n, the top boundary elements are the elements in the range matrix[0][0] to matrix[0][n-1], the bottom boundary elements are the elements in the range matrix[m-1][0] to matrix[m-1][n-1], the left boundary elements are the elements in the range matrix[0][0] to matrix[m-1][0], and the right boundary elements ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
899 Views
What is 2D array in Golang? In Go programming language, a 2D array is an array of arrays, where each element of the outer array is a simple array itself. The code to declare a 2d array of size 2 X 3 can be done by writing var array [2][3]. It's important to note that 2D arrays have a fixed size, and once they are created, their size cannot be changed. If you need a dynamic 2D array, you can use a slice of slices. Here is an example of sorting a 2d array across columns − Input 3 2 1 6 4 5 ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
6K+ Views
In Go Language, we have various data types to store data and the String data type is the one that is used to store a sequence of characters. The size of string variable is 1 or 8 bits. An array on the other hand is a data type that is used to store data at contiguous memory locations. Syntax func fields(s string) []string fields() function is present in strings package and is used to convert a string to an array of string. This function takes a string value as an argument and returns the corresponding array as the result. ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
705 Views
What is the Object of a Class? Object stores Key-value pairs of data together. There are numerous methods for producing an object. Some of them will be covered in this post. In this article, we are going to use two different methods to print objects of a class in the go programming language. Method 1: Using a Structure In this method, we will first create some structures and in the main() produce objects out of them. further we will store properties to that objects and print them on the screen. This can be obtained by following Steps. Algorithm Step ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
761 Views
In go programming language, there are two types of access modifiers i.e Exported and un-exported. Identifiers that are exported from the package in which they are specified are known as exported identifiers. They always begin with a capital letter. These are only valid in the package in which they are defined. Identifiers that are not exported from any package are referred to as un-exported identifiers that are written in lowercase. Syntax func len(v Type) int The len() function is used to get the length of a any parameter. It takes one parameter as the data type variable whose ... Read More