mirror of
https://github.com/bootdotdev/fcc-learn-golang-assets.git
synced 2025-12-18 19:21:17 +00:00
first
This commit is contained in:
27
course/6-errors/exercises/2-formatting_strings/complete.go
Normal file
27
course/6-errors/exercises/2-formatting_strings/complete.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func getSMSErrorString(cost float64, recipient string) string {
|
||||
return fmt.Sprintf("SMS that costs $%.2f to be sent to '%v' can not be sent",
|
||||
cost,
|
||||
recipient,
|
||||
)
|
||||
}
|
||||
|
||||
// don't edit below this line
|
||||
|
||||
func test(cost float64, recipient string) {
|
||||
s := getSMSErrorString(cost, recipient)
|
||||
fmt.Println(s)
|
||||
fmt.Println("====================================")
|
||||
}
|
||||
|
||||
func main() {
|
||||
test(1.4, "+1 (435) 555 0923")
|
||||
test(2.1, "+2 (702) 555 3452")
|
||||
test(32.1, "+1 (801) 555 7456")
|
||||
test(14.4, "+1 (234) 555 6545")
|
||||
}
|
||||
Reference in New Issue
Block a user