Akhil Sharma has Published 653 Articles

Golang program to compare elements in two slices

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:29:33

2K+ Views

In this tutorial, we will learn how to compare elements in two slices. In slices a simple equality comparison is not possible so the slices are compared with their lengths and the elements present in the loop. The output will be printed in the form of Boolean value on the ... Read More

Golang program to replace elements in a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:27:30

2K+ 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 ... Read More

Golang program to print a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:25:09

945 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 ... Read More

Golang program to reverse a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:19:09

2K+ 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 ... Read More

Golang program to remove an element from a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 12:03:48

611 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 ... Read More

Golang program to find the largest element in a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 11:57:09

635 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 ... Read More

Golang program to add elements to a slice

Akhil Sharma

Akhil Sharma

Updated on 17-Jan-2023 11:42:47

438 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 ... Read More

Golang Program To Push An Array Into Another Array

Akhil Sharma

Akhil Sharma

Updated on 10-Jan-2023 15:03:23

2K+ Views

In this tutorial, we will write a go language program to push an array to another array. There are many methods for this. The simplest one is to use equality operator. Here, we will see 3 methods via which we can transfer the contents of one array to another in ... Read More

Golang Program To Get The Last Given Number Of Items From The Array

Akhil Sharma

Akhil Sharma

Updated on 10-Jan-2023 15:00:21

88 Views

In this tutorial, we will write a go language program to remove the last given number of items from an array. We can do this by either using the inbuilt functions in go or using for loops. The first method is more efficient in functionality than the second one but ... Read More

Golang Program To Get The First Item From The Array

Akhil Sharma

Akhil Sharma

Updated on 10-Jan-2023 14:57:36

1K+ Views

In this tutorial, we will write a go language program to get the first item from an array. An array is a data structure that is used to store elements in contiguous memory locations. Here, we will write two programs to store the first element in the array. In the ... Read More

Advertisements