add: calculator example to x-tba
This commit is contained in:
16
x-tba/foundations/calc/01-shortdecl-int-conv/main.go
Normal file
16
x-tba/foundations/calc/01-shortdecl-int-conv/main.go
Normal file
@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// lesson: multi-return funcs, %v, and _
|
||||
|
||||
a, _ := strconv.Atoi(os.Args[1])
|
||||
b, _ := strconv.Atoi(os.Args[2])
|
||||
|
||||
fmt.Printf("%v + %v = %v\n", a, b, a+b)
|
||||
}
|
Reference in New Issue
Block a user