From 4ea8dfb6b3ba5c7cace20cb12b82942780549977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=81=A3?= <⁣> Date: Sun, 17 May 2020 11:58:47 +0200 Subject: [PATCH] Rename variables to more idiomatic Go --- subjects/atoi.en.md | 34 ++++++++-------------------------- subjects/basicatoi.en.md | 14 +++----------- subjects/basicatoi2.en.md | 19 ++++--------------- subjects/basicjoin.en.md | 6 +++--- 4 files changed, 18 insertions(+), 55 deletions(-) diff --git a/subjects/atoi.en.md b/subjects/atoi.en.md index 5a8738a2d..21d70dfe5 100644 --- a/subjects/atoi.en.md +++ b/subjects/atoi.en.md @@ -31,32 +31,14 @@ import ( ) func main() { - s := "12345" - s2 := "0000000012345" - s3 := "012 345" - s4 := "Hello World!" - s5 := "+1234" - s6 := "-1234" - s7 := "++1234" - s8 := "--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) + fmt.Println(piscine.Atoi("12345")) + fmt.Println(piscine.Atoi("0000000012345")) + fmt.Println(piscine.Atoi("012 345")) + fmt.Println(piscine.Atoi("Hello World!")) + fmt.Println(piscine.Atoi("+1234")) + fmt.Println(piscine.Atoi("-1234")) + fmt.Println(piscine.Atoi("++1234")) + fmt.Println(piscine.Atoi("--1234")) } ``` diff --git a/subjects/basicatoi.en.md b/subjects/basicatoi.en.md index 6103921df..19a9e8444 100644 --- a/subjects/basicatoi.en.md +++ b/subjects/basicatoi.en.md @@ -31,17 +31,9 @@ import ( ) func main() { - s := "12345" - s2 := "0000000012345" - s3 := "000000" - - n := piscine.BasicAtoi(s) - n2 := piscine.BasicAtoi(s2) - n3 := piscine.BasicAtoi(s3) - - fmt.Println(n) - fmt.Println(n2) - fmt.Println(n3) + fmt.Println(piscine.BasicAtoi("12345")) + fmt.Println(piscine.BasicAtoi("0000000012345")) + fmt.Println(piscine.BasicAtoi("000000")) } ``` diff --git a/subjects/basicatoi2.en.md b/subjects/basicatoi2.en.md index 520598791..e248778c8 100644 --- a/subjects/basicatoi2.en.md +++ b/subjects/basicatoi2.en.md @@ -31,21 +31,10 @@ import ( ) func main() { - s := "12345" - s2 := "0000000012345" - s3 := "012 345" - s4 := "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) - + fmt.Println(piscine.BasicAtoi2("12345")) + fmt.Println(piscine.BasicAtoi2("0000000012345")) + fmt.Println(piscine.BasicAtoi2("012 345")) + fmt.Println(piscine.BasicAtoi2("Hello World!")) } ``` diff --git a/subjects/basicjoin.en.md b/subjects/basicjoin.en.md index db3b26b24..bba6caa06 100644 --- a/subjects/basicjoin.en.md +++ b/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 ```go -func BasicJoin(strs []string) string { +func BasicJoin(elems []string) string { } ``` @@ -25,8 +25,8 @@ import ( ) func main() { - toConcat := []string{"Hello!", " How", " are", " you?"} - fmt.Println(piscine.BasicJoin(toConcat)) + elems := []string{"Hello!", " How", " are", " you?"} + fmt.Println(piscine.BasicJoin(elems)) } ```