fix: refactor feet to meter exercises

This commit is contained in:
Inanc Gumus
2018-11-10 19:39:38 +03:00
parent 65fd15a599
commit 591609734e
2 changed files with 7 additions and 6 deletions

View File

@ -20,7 +20,7 @@ package main
func main() { func main() {
// ---------------------------- // ----------------------------
// 1. Define Feet and Meters types below // 1. Define Feet and Meters types below
// Their underlying type can be int64 // Their underlying type can be float64
// ... // ...
// ---------------------------- // ----------------------------
@ -32,7 +32,7 @@ func main() {
// ---------------------------- // ----------------------------
// 3. Get feet value from the command-line // 3. Get feet value from the command-line
// 4. Convert it to an int64 first using ParseFloat // 4. Convert it to an float64 first using ParseFloat
// 5. Then, convert it into a Feet type // 5. Then, convert it into a Feet type
// ... TYPE YOUR CODE HERE // ... TYPE YOUR CODE HERE

View File

@ -13,11 +13,12 @@ import (
"strconv" "strconv"
) )
// WHY?
// Because, you can add methods to your types in the future
// And, they're type-safe and more readable now.
func main() { func main() {
// WHY ADDING YOUR OWN TYPES IS IMPORTANT?
//
// 1. Type-Safety
// 2. Increased Readability
// 3. Adding Methods to your Types
type ( type (
Feet float64 Feet float64
Meters float64 Meters float64