package main

import "fmt"

func swap(array []int, i int, j int) {
    temp := array[i]
    array[i] = array[j]
    array[j] = temp
}
func indexOfMin(array []int, startIndex int) int {
    minValue := array[startIndex]
    minIndex := startIndex
    for i := minIndex + 1; i < len(array); i++ {
        if array[i] < minValue {
            minValue = array[i]
            minIndex = i
        }
    }
    return minIndex
}
func selectSort(array []int) {
    for i := 0; i < len(array); i++ {
        j := indexOfMin(array, i)
        swap(array, i, j)
    }
}
func main() {
    fmt.Println("Hello world!")
    array := []int{4,2,5,1,3}
    fmt.Println(array)
    selectSort(array)
    fmt.Println(array)    
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: