# Golang Ints function sort slice ascending or descending

Today, We want to share with you Golang Ints function sort slice ascending or descending.In this post we will show you Golang : Sort and reverse sort a slice of integers, hear for Most Popular Golang Slice Sort, Reverse, Search Functions we will give you demo and example for implement.In this post, we will learn about Sorting an Array of Numbered String Values with an example.

## Golang Ints function sort slice ascending or descending

Contents

There are the Following The simple About Golang Ints function sort slice ascending or descending Full Information With Example and source code.

As I will cover this Post with live Working example to develop golang sort slice ascending or descending, so the sort – The Go Programming Language for this example is following below.

### Golang Ints function [ascending order]

The Ints function sorts a slice of integer in ascending order.

Go program Syntax:

```func Ints(productIdSlice []int)
```

Go program Example:

```package main

import (
"fmt"
"sort"
)

func main() {
productIdSlice := []int{10, 5, 25, 351, 14, 9} // unsorted list in Go Pro.
fmt.Println("Your Slice of integer BEFORE some sort order:",productIdSlice)
sort.Ints(productIdSlice)
fmt.Println("Your Data Slice of integer AFTER some sort Data:",productIdSlice)
}
```

When simple We execute the Go program, We can get the display following output:

```C:\golang>go run sort.go
Your Slice of integer BEFORE some sort order: [10 5 25 351 14 9]
Your Data Slice of integer AFTER some sort Data: [5 9 10 14 25 351]

C:\golang>
```