mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-25 21:26:03 +03:00
23 lines
273 B
Go
23 lines
273 B
Go
|
package state
|
||
|
|
||
|
func ExampleWeek() {
|
||
|
ctx := NewDayContext()
|
||
|
todayAndNext := func() {
|
||
|
ctx.Today()
|
||
|
ctx.Next()
|
||
|
}
|
||
|
|
||
|
for i := 0; i < 8; i++ {
|
||
|
todayAndNext()
|
||
|
}
|
||
|
// Output:
|
||
|
// Sunday
|
||
|
// Monday
|
||
|
// Tuesday
|
||
|
// Wednesday
|
||
|
// Thursday
|
||
|
// Friday
|
||
|
// Saturday
|
||
|
// Sunday
|
||
|
}
|