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

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World