- 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)
3K+ Views
In this tutorial, , we will grasp how to replace elements in a slice using different set of examples. A slice is a dynamic array which means that its value is not fixed like array. The output will be printed on the screen using fmt.Println() function. Let’s see how it can be implemented with crystal-clear examples. Method 1: Using built-in copy function In this method, we will use the built-in function copy to replace elements in slice which means at the place of original element and new element will be placed. The built-in functions shorten the code and easily solve ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
2K+ Views
In this tutorial, we will learn different methods to print a slice. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s understand this basic concept using different set of examples and algorithms based upon them. Method 1: Using make function In this method, we will create a slice with the help of make function and ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
3K+ Views
In this tutorial, we will learn how to reverse a slice using variety of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. 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 ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
3K+ Views
In this tutorial, we will grasp how to search an element in slice using different set of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. 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 ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
818 Views
In this tutorial, we will learn how to remove an element from a slice using variety of examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. Syntax func copy(dst, str[] type) int The copy function in go language is used to copy the values of ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
922 Views
In this tutorial, we will inculcate how to find the largest element in a slice using some examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. Method 1: Using a user-defined function and append() function In this method, we will see how to find the largest element ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
768 Views
In this tutorial, we will learn how to add elements to a slice using different examples. A slice is a sequence of elements just like an array. An array is a fixed sequence of elements whereas slice is a dynamic array which means its value is not fixed and can be changed. Slices are more efficient and faster than arrays moreover they are passed by reference instead by value. Let’s go through the example to understand things. Method 1: Using append function with strings In this method, we will use append function to add string elements to the slice. ... Read More
![Aman Sharma](https://www.tutorialspoint.com/assets/profiles/502230/profile/60_2055880-1660630704.jpg)
1K+ Views
In this tutorial, we will learn how to check whether the number is positive or negative. This tutorial includes two ways to achieve this by using the built-in function Signbit() present in the math library. Another way is to use the relation operators using which we can compare a number with zero and predict whether the number is positive or not. Method 1: Using Signbit() function In this example, we are going to use the built-in function Signbit() present in the math library to check whether the number is positive or negative. Syntax Signbit() is a function in math library ... Read More
![Aman Sharma](https://www.tutorialspoint.com/assets/profiles/502230/profile/60_2055880-1660630704.jpg)
673 Views
This tutorial will teach us how to create a function with arguments and a return value. This tutorial involves a gist about the function, and syntax for the function with an argument and a return type in Golang, then last we will see two different examples of a function with arguments and with a return type. In one example we will return the sum of two numbers and in the other one, we will return the area of the circle. Functions in the Programming language. Let us first see what function is. The function is a subset of a program ... Read More
![Aman Sharma](https://www.tutorialspoint.com/assets/profiles/502230/profile/60_2055880-1660630704.jpg)
244 Views
This tutorial will teach us how to create a function with arguments but without a return value. This tutorial involves a gist about the function, and syntax for the function with argument and without return type in Golang, then last we will see two different examples of a function with arguments but without a return type. In the first example, we are going to print the argument passed in the function with the respective statement. In the other example, we are going to add the numbers passed as arguments and print the sum in the same function. Function with argument ... Read More