You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now函数的参数个数是可变数量的,但是,看Carbon.Now的实现,却是取最后一个值,这样定义的函数,对于调用者来说会不会产生误解?我的问题是,为什么要将参数定义成可变参数呢?
The number of parameters for the Now function is variable; however, in the implementation of Carbon.Now, it only takes the last value. Won't such a definition of the function lead to misunderstandings for the caller? My question is, why are the parameters defined as variable?
// Now returns a Carbon instance for now.// 当前func (cCarbon) Now(timezone...string) Carbon {
iflen(timezone) >0 {
c.loc, c.Error=getLocationByTimezone(timezone[len(timezone)-1])
}
....
}
The text was updated successfully, but these errors were encountered:
maliyan
added
the
Question
Indicates that an issue, pull request, or discussion needs more information
label
Nov 13, 2023
Now
函数的参数个数是可变数量的,但是,看Carbon.Now
的实现,却是取最后一个值,这样定义的函数,对于调用者来说会不会产生误解?我的问题是,为什么要将参数定义成可变参数呢?The number of parameters for the Now function is variable; however, in the implementation of Carbon.Now, it only takes the last value. Won't such a definition of the function lead to misunderstandings for the caller? My question is, why are the parameters defined as variable?
The text was updated successfully, but these errors were encountered: