From fbfab149ec82fcb661301bb394ee331a7b541130 Mon Sep 17 00:00:00 2001 From: estlop Date: Thu, 30 Jun 2022 13:22:51 +0100 Subject: [PATCH] Write readme for delete subject --- subjects/delete/README.md | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 subjects/delete/README.md diff --git a/subjects/delete/README.md b/subjects/delete/README.md new file mode 100644 index 00000000..63274c57 --- /dev/null +++ b/subjects/delete/README.md @@ -0,0 +1,40 @@ +## delete + +### Instructions + +Write a function that removes the element at a given position of a slice of ints. It should return a new slice with the result. If the position is out of range, it should return the original slice. + +### Expected function + +```go +func Delete(ints []int, position int) []int { +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "piscine" + "fmt" +) + +func main() { + fmt.Println(piscine.Delete([1, 2, 3, 4, 5], 2)) + fmt.Println(piscine.Delete([1, 2, 3, 4, 5], 3)) + fmt.Println(piscine.Delete([1, 2, 3, 4, 5], 1)) +} +``` + +And its output : + +```console +$ go run . | cat -e +[1 3 4 5]$ +[1 2 4 5]$ +[2 3 4 5]$ +```