go - Using new and assigning variable at the same time -
wd := new(time.weekday) fmt.println(wd.string())
the above 2 lines return sunday (weekdays start 0)
is possible me assign value along new ? other method tried
var wd time.weekday wd = 3
this 1 returns wednesday
time.weekday int can assign such (or use defined constants adam suggested). can ask why need use new in situation?
package main import ( "fmt" "time" ) func main() { var wd time.weekday = 3 fmt.println(wd) }
Comments
Post a Comment