How to use Array Reverse Sort Functions for Integer and Strings in Golang? Last Updated : 17 May, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Go language provides inbuilt support implementation of basic constants and run-time reflection to operate sort package. Golang is the ability for functions to run independently of each other. With the help of this function we can easily sort integer and string by importing "sort" package. Basically, this will sort the Integer and Strings in Reverse order. Syntax: func Reverse(data Interface) Interface Return Value: This function returns the value of IntSlice and StringSlice value. Below examples illustrate the use of the above method in Golang: Example 1: C // Golang program to show the uses of // Integer Reverse Sort Function package main import ( "fmt" "sort" ) func main() { fmt.Println("Example For Integer Reverse Sort") num := []int{70, 80, 20, 50, 10} // using the function sort.Sort(sort.Reverse(sort.IntSlice(num))) fmt.Println(num) } Output: Example For Integer Reverse Sort [80 70 50 20 10] Example 2: C // Golang program to show the uses of // String Reverse Sort Function package main import ( "fmt" "sort" ) func main() { fmt.Println("Example For String Reverse Sort") str:= []string{"GFG","Rank","India","Amid","Covid19"} // using the function sort.Sort(sort.Reverse(sort.StringSlice(str))) fmt.Println(str) } Output: Example For String Reverse Sort [Rank India GFG Covid19 Amid] Comment More infoAdvertise with us Next Article How to Convert string to integer type in Golang? S shivanisinghss2110 Follow Improve Article Tags : Go Language Golang-String Golang-Program Similar Reads How to pass an Array to a Function in Golang? In Go, arrays are used to store a fixed-length collection of data of the same type. To manage this data effectively, you may often need to pass arrays to functions. In this article we will learn "How to pass an Array to a Function in Golang".Example:Gopackage main import "fmt" // Function to calcula 2 min read How to iterate over an Array using for loop in Golang? An array is a data structure of the collection of items of the similar type stored in contiguous locations. For performing operations on arrays, the need arises to iterate through it. A for loop is used to iterate over data structures in programming languages. It can be used here in the following wa 2 min read How to Sort a Slice of Strings in Golang? In Go, a slice is a flexible data structure that stores a variable-length sequence of elements of the same type. Unlike arrays, slices can dynamically grow and shrink. You cannot mix different types within a slice. Go provides built-in functions for sorting slices, particularly for strings, found in 2 min read How to Reverse a String in Golang? Given a string and the task is to reverse the string. Here are a few examples. Approach 1: Reverse the string by swapping the letters, like first with last and second with second last and so on. Example: C // Golang program to reverse a string package main // importing fmt import "fmt" // function, 2 min read How to Convert string to integer type in Golang? Strings in Golang is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding. In Go language, both signed and unsigned integers are available in four different sizes. In order to convert string to integer type in Golang, you can 2 min read How to sort an array in descending order in Ruby? In this article, we will discuss how to sort an array in descending order in ruby. We can sort an array in descending order through different methods ranging from using sort the method with a block to using the reverse method after sorting in ascending order Table of Content Sort an array in descend 3 min read Like