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

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -