8
假設你正在使用一個func函數返回一個布爾值,以確定用戶是否在上個月處於活動狀態。轉到慣用的方式來命名布爾謂詞函數
在Ruby:
def active_in_last_month?;end
在C#
public bool WasActiveInLastMonth(){}
什麼是圍棋命名布爾謂詞函數的慣用方法是什麼?
假設你正在使用一個func函數返回一個布爾值,以確定用戶是否在上個月處於活動狀態。轉到慣用的方式來命名布爾謂詞函數
在Ruby:
def active_in_last_month?;end
在C#
public bool WasActiveInLastMonth(){}
什麼是圍棋命名布爾謂詞函數的慣用方法是什麼?
您通常使用「設置」
WasActiveInLastMonth() { return wasActiveInLastMonth }
SetWasActiveInLastMonth(newVal bool) { wasActiveInLastMonth = newval }
假設你有一個私人領域wasActiveInLastMonth
不幸的是,在圍棋佈爾謂詞沒有習慣的方法前綴的制定者,請不要誤導。 – maxbublis
這個答案與問題無關。 –
那爲什麼他會接受呢? –