Advertisement
Bryanpedini

arrayInt64Remove.go

Oct 2nd, 2022 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.27 KB | None | 0 0
  1. package main
  2.  
  3. import "errors"
  4.  
  5. func arrayInt64Remove(a *[]int64, s int) error {
  6.     n := []int64{}
  7.     if s >= len(*a) {
  8.         return errors.New("index out of bound exception")
  9.     }
  10.     for i, e := range *a {
  11.         if i != s {
  12.             n = append(n, e)
  13.         }
  14.     }
  15.     a = &n
  16.     return nil
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement