SHARE
TWEET

Untitled

a guest Jun 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     arr := [...]int{0, 1, 2}
  9.     for i := range arr {
  10.         fmt.Println(i, ":", arr, arr[:i], arr[i+1:], "::", append(arr[:i], arr[i+1:]...))
  11.  
  12.     }
  13.     fmt.Println("arr :", arr)
  14. }
  15.      
  16. 0 : [0 1 2] [] [2 2] :: [1 2]
  17. 1 : [1 2 2] [1] [2] :: [1 2]
  18. 2 : [1 2 2] [1 2] [] :: [1 2]
  19. arr : [1 2 2]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top