Sha256: 37f06266ffcbabd240ccc51e9648ba1184a22052a02457dbaab3604ffe238813
Contents?: true
Size: 848 Bytes
Versions: 144
Compression:
Stored size: 848 Bytes
Contents
package clock import "fmt" func ExampleClock_new() { // a new clock clock1 := New(10, 30) fmt.Println(clock1.String()) // Output: 10:30 } func ExampleClock_Add_add() { // create a clock clock := New(10, 30) // add 30 minutes to it clock = clock.Add(30) fmt.Println(clock.String()) // Output: 11:00 } func ExampleClock_Add_subtract() { // create a clock clock := New(10, 30) // subtract an hour and a half from it clock = clock.Add(-90) fmt.Println(clock.String()) // Output: 09:00 } func ExampleClock_compare() { // a new clock clock1 := New(10, 30) // a second clock, same as the first clock2 := New(10, 30) // are the clocks equal? fmt.Println(clock2 == clock1) // change the second clock clock2 = clock2.Add(30) // are the clocks equal now? fmt.Println(clock2 == clock1) // Output: // true // false }
Version data entries
144 entries across 144 versions & 1 rubygems