From 14de3fbf11db763c7a956a8862c1c0a15f817a48 Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Sat, 27 Oct 2018 17:15:30 +0300 Subject: [PATCH] add: go type system exercises --- .../exercises/{01 => 01-optimal-types}/main.go | 3 ++- .../{01 => 01-optimal-types}/solution/main.go | 0 .../exercises/{02 => 02-the-type-problem}/main.go | 3 ++- .../{02 => 02-the-type-problem}/solution/main.go | 0 .../exercises/{03 => 03-parse-arg-numbers}/main.go | 3 ++- .../{03 => 03-parse-arg-numbers}/solution/main.go | 0 .../exercises/{04 => 04-time-multiplier}/main.go | 3 ++- .../{04 => 04-time-multiplier}/solution/main.go | 0 .../{05 => 05-refactor-feet-to-meter}/main.go | 3 ++- .../solution/main.go | 0 .../exercises/{06 => 06-convert-the-types}/main.go | 3 ++- .../{06 => 06-convert-the-types}/solution/main.go | 0 09-go-type-system/exercises/README.md | 13 +++++++++++++ 13 files changed, 25 insertions(+), 6 deletions(-) rename 09-go-type-system/exercises/{01 => 01-optimal-types}/main.go (97%) rename 09-go-type-system/exercises/{01 => 01-optimal-types}/solution/main.go (100%) rename 09-go-type-system/exercises/{02 => 02-the-type-problem}/main.go (96%) rename 09-go-type-system/exercises/{02 => 02-the-type-problem}/solution/main.go (100%) rename 09-go-type-system/exercises/{03 => 03-parse-arg-numbers}/main.go (98%) rename 09-go-type-system/exercises/{03 => 03-parse-arg-numbers}/solution/main.go (100%) rename 09-go-type-system/exercises/{04 => 04-time-multiplier}/main.go (97%) rename 09-go-type-system/exercises/{04 => 04-time-multiplier}/solution/main.go (100%) rename 09-go-type-system/exercises/{05 => 05-refactor-feet-to-meter}/main.go (96%) rename 09-go-type-system/exercises/{05 => 05-refactor-feet-to-meter}/solution/main.go (100%) rename 09-go-type-system/exercises/{06 => 06-convert-the-types}/main.go (97%) rename 09-go-type-system/exercises/{06 => 06-convert-the-types}/solution/main.go (100%) create mode 100644 09-go-type-system/exercises/README.md diff --git a/09-go-type-system/exercises/01/main.go b/09-go-type-system/exercises/01-optimal-types/main.go similarity index 97% rename from 09-go-type-system/exercises/01/main.go rename to 09-go-type-system/exercises/01-optimal-types/main.go index 23b5f28..0cf8998 100644 --- a/09-go-type-system/exercises/01/main.go +++ b/09-go-type-system/exercises/01-optimal-types/main.go @@ -8,7 +8,8 @@ package main // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Optimal Types +// // 1. Choose the optimal data types for the given situations. // 2. Print them all // 3. Try converting them to lesser data types. diff --git a/09-go-type-system/exercises/01/solution/main.go b/09-go-type-system/exercises/01-optimal-types/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/01/solution/main.go rename to 09-go-type-system/exercises/01-optimal-types/solution/main.go diff --git a/09-go-type-system/exercises/02/main.go b/09-go-type-system/exercises/02-the-type-problem/main.go similarity index 96% rename from 09-go-type-system/exercises/02/main.go rename to 09-go-type-system/exercises/02-the-type-problem/main.go index 81ae157..027b997 100644 --- a/09-go-type-system/exercises/02/main.go +++ b/09-go-type-system/exercises/02-the-type-problem/main.go @@ -12,7 +12,8 @@ import ( ) // --------------------------------------------------------- -// EXERCISE +// EXERCISE: The Type Problem +// // Solve the data type problem in the program. // // EXPECTED OUTPUT diff --git a/09-go-type-system/exercises/02/solution/main.go b/09-go-type-system/exercises/02-the-type-problem/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/02/solution/main.go rename to 09-go-type-system/exercises/02-the-type-problem/solution/main.go diff --git a/09-go-type-system/exercises/03/main.go b/09-go-type-system/exercises/03-parse-arg-numbers/main.go similarity index 98% rename from 09-go-type-system/exercises/03/main.go rename to 09-go-type-system/exercises/03-parse-arg-numbers/main.go index 9a407fc..ad3ddbe 100644 --- a/09-go-type-system/exercises/03/main.go +++ b/09-go-type-system/exercises/03-parse-arg-numbers/main.go @@ -14,7 +14,8 @@ import ( ) // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Parse Arg Numbers +// // Use strconv.ParseInt function to get int8, int16, and // int32, and int64 values from command-line. // diff --git a/09-go-type-system/exercises/03/solution/main.go b/09-go-type-system/exercises/03-parse-arg-numbers/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/03/solution/main.go rename to 09-go-type-system/exercises/03-parse-arg-numbers/solution/main.go diff --git a/09-go-type-system/exercises/04/main.go b/09-go-type-system/exercises/04-time-multiplier/main.go similarity index 97% rename from 09-go-type-system/exercises/04/main.go rename to 09-go-type-system/exercises/04-time-multiplier/main.go index 73474ff..b3b902f 100644 --- a/09-go-type-system/exercises/04/main.go +++ b/09-go-type-system/exercises/04-time-multiplier/main.go @@ -13,7 +13,8 @@ import ( ) // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Time Multiplier +// // You should get an argument from the command-line and // you need to multiply the time duration value `t` with // the given argument. diff --git a/09-go-type-system/exercises/04/solution/main.go b/09-go-type-system/exercises/04-time-multiplier/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/04/solution/main.go rename to 09-go-type-system/exercises/04-time-multiplier/solution/main.go diff --git a/09-go-type-system/exercises/05/main.go b/09-go-type-system/exercises/05-refactor-feet-to-meter/main.go similarity index 96% rename from 09-go-type-system/exercises/05/main.go rename to 09-go-type-system/exercises/05-refactor-feet-to-meter/main.go index 209acaf..b8a121b 100644 --- a/09-go-type-system/exercises/05/main.go +++ b/09-go-type-system/exercises/05-refactor-feet-to-meter/main.go @@ -8,7 +8,8 @@ package main // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Refactor Feet to Meter +// // Remember the feet to meters program? // Now, it's time to refactor it. // Define your own Feet and Meters types. diff --git a/09-go-type-system/exercises/05/solution/main.go b/09-go-type-system/exercises/05-refactor-feet-to-meter/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/05/solution/main.go rename to 09-go-type-system/exercises/05-refactor-feet-to-meter/solution/main.go diff --git a/09-go-type-system/exercises/06/main.go b/09-go-type-system/exercises/06-convert-the-types/main.go similarity index 97% rename from 09-go-type-system/exercises/06/main.go rename to 09-go-type-system/exercises/06-convert-the-types/main.go index dd29443..a1c8903 100644 --- a/09-go-type-system/exercises/06/main.go +++ b/09-go-type-system/exercises/06-convert-the-types/main.go @@ -10,7 +10,8 @@ package main import "fmt" // --------------------------------------------------------- -// EXERCISE +// EXERCISE: Convert the Types +// // Convert the variables to appropriate types. // // EXPECTED OUTPUT diff --git a/09-go-type-system/exercises/06/solution/main.go b/09-go-type-system/exercises/06-convert-the-types/solution/main.go similarity index 100% rename from 09-go-type-system/exercises/06/solution/main.go rename to 09-go-type-system/exercises/06-convert-the-types/solution/main.go diff --git a/09-go-type-system/exercises/README.md b/09-go-type-system/exercises/README.md new file mode 100644 index 0000000..77d564b --- /dev/null +++ b/09-go-type-system/exercises/README.md @@ -0,0 +1,13 @@ +# Types + +1. **[Find the Optimal Types](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/01-optimal-types)** + +2. **[Fix the Type Problem](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/02-the-type-problem)** + +3. **[Parse Arg Numbers](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/03-parse-arg-numbers)** + +4. **[Time Multiplier](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/04-time-multiplier)** + +5. **[Refactor Feet to Meter](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/05-refactor-feet-to-meter)** + +6. **[Convert the Types](https://github.com/inancgumus/learngo/tree/master/09-go-type-system/exercises/06-convert-the-types)** \ No newline at end of file