Browse Source

Rename variables to more idiomatic Go

content-update
4 years ago committed by xpetit
parent
commit
4ea8dfb6b3
  1. 34
      subjects/atoi.en.md
  2. 14
      subjects/basicatoi.en.md
  3. 19
      subjects/basicatoi2.en.md
  4. 6
      subjects/basicjoin.en.md

34
subjects/atoi.en.md

@ -31,32 +31,14 @@ import (
) )
func main() { func main() {
s := "12345" fmt.Println(piscine.Atoi("12345"))
s2 := "0000000012345" fmt.Println(piscine.Atoi("0000000012345"))
s3 := "012 345" fmt.Println(piscine.Atoi("012 345"))
s4 := "Hello World!" fmt.Println(piscine.Atoi("Hello World!"))
s5 := "+1234" fmt.Println(piscine.Atoi("+1234"))
s6 := "-1234" fmt.Println(piscine.Atoi("-1234"))
s7 := "++1234" fmt.Println(piscine.Atoi("++1234"))
s8 := "--1234" fmt.Println(piscine.Atoi("--1234"))
n := piscine.Atoi(s)
n2 := piscine.Atoi(s2)
n3 := piscine.Atoi(s3)
n4 := piscine.Atoi(s4)
n5 := piscine.Atoi(s5)
n6 := piscine.Atoi(s6)
n7 := piscine.Atoi(s7)
n8 := piscine.Atoi(s8)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
fmt.Println(n5)
fmt.Println(n6)
fmt.Println(n7)
fmt.Println(n8)
} }
``` ```

14
subjects/basicatoi.en.md

@ -31,17 +31,9 @@ import (
) )
func main() { func main() {
s := "12345" fmt.Println(piscine.BasicAtoi("12345"))
s2 := "0000000012345" fmt.Println(piscine.BasicAtoi("0000000012345"))
s3 := "000000" fmt.Println(piscine.BasicAtoi("000000"))
n := piscine.BasicAtoi(s)
n2 := piscine.BasicAtoi(s2)
n3 := piscine.BasicAtoi(s3)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
} }
``` ```

19
subjects/basicatoi2.en.md

@ -31,21 +31,10 @@ import (
) )
func main() { func main() {
s := "12345" fmt.Println(piscine.BasicAtoi2("12345"))
s2 := "0000000012345" fmt.Println(piscine.BasicAtoi2("0000000012345"))
s3 := "012 345" fmt.Println(piscine.BasicAtoi2("012 345"))
s4 := "Hello World!" fmt.Println(piscine.BasicAtoi2("Hello World!"))
n := piscine.BasicAtoi2(s)
n2 := piscine.BasicAtoi2(s2)
n3 := piscine.BasicAtoi2(s3)
n4 := piscine.BasicAtoi2(s4)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
} }
``` ```

6
subjects/basicjoin.en.md

@ -7,7 +7,7 @@ Write a function that returns the concatenation of all the `string` of a slice o
### Expected function ### Expected function
```go ```go
func BasicJoin(strs []string) string { func BasicJoin(elems []string) string {
} }
``` ```
@ -25,8 +25,8 @@ import (
) )
func main() { func main() {
toConcat := []string{"Hello!", " How", " are", " you?"} elems := []string{"Hello!", " How", " are", " you?"}
fmt.Println(piscine.BasicJoin(toConcat)) fmt.Println(piscine.BasicJoin(elems))
} }
``` ```

Loading…
Cancel
Save