lean into examples
This commit is contained in:
20
examples/string-formatting/string-formatting.go
Normal file
20
examples/string-formatting/string-formatting.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Point struct {
|
||||
x, y int
|
||||
}
|
||||
|
||||
func main() {
|
||||
point := Point{1, 2}
|
||||
|
||||
fmt.Printf("default: %v\n", point)
|
||||
fmt.Printf("default w/ vals: %+v\n", point)
|
||||
fmt.Printf("go: %#v\n", point)
|
||||
fmt.Printf("go type: %T\n", point)
|
||||
|
||||
fmt.Printf("boolean: %t\n", true)
|
||||
}
|
||||
|
||||
// todo: the rest
|
||||
6
examples/string-formatting/string-formatting.sh
Normal file
6
examples/string-formatting/string-formatting.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
$ go run string-formatting.go
|
||||
default: {1 2}
|
||||
default w/ vals: {x:1 y:2}
|
||||
go: main.Point{x:1, y:2}
|
||||
go type: main.Point
|
||||
boolean: true
|
||||
Reference in New Issue
Block a user