restructure: arrays and slices
This commit is contained in:
41
16-slices/exercises/08-append-2/main.go
Normal file
41
16-slices/exercises/08-append-2/main.go
Normal file
@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// EXERCISE: Append #2
|
||||
//
|
||||
// 1. Create the following nil slices:
|
||||
// + Pizza toppings
|
||||
// + Departure times
|
||||
// + Student graduation years
|
||||
// + On/off states of lights in a room
|
||||
//
|
||||
// 2. Append them some elements (use your creativity!)
|
||||
//
|
||||
// 3. Print all the slices
|
||||
//
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
// (Your output may change, mine is like so:)
|
||||
//
|
||||
// pizza : [pepperoni onions extra cheese]
|
||||
//
|
||||
// graduations : [1998 2005 2018]
|
||||
//
|
||||
// departures : [2019-01-28 15:09:31.294594 +0300 +03 m=+0.000325020
|
||||
// 2019-01-29 15:09:31.294594 +0300 +03 m=+86400.000325020
|
||||
// 2019-01-30 15:09:31.294594 +0300 +03 m=+172800.000325020]
|
||||
//
|
||||
// lights : [true false true]
|
||||
//
|
||||
//
|
||||
// HINTS
|
||||
// + For departure times, use the time.Time type. Check its documentation.
|
||||
//
|
||||
// now := time.Now() -> Gives you the current time
|
||||
// now.Add(time.Hour*24) -> Gives you a time.Time 24 hours after `now`
|
||||
//
|
||||
// + For graduation years, you can use the int type
|
||||
// ---------------------------------------------------------
|
||||
|
||||
func main() {
|
||||
}
|
Reference in New Issue
Block a user