對不起,如果我不以正確的方式問我的問題。 試圖讓這一點的Ruby代碼工作。我不明白的是如何讓底部的點擊操作調用yield函數(這是一個交通燈),以便點擊將循環訪問yield選項。真實的,錯誤的,錯誤的將意味着光是紅色的,因爲它在頂部,而底部的是錯誤的。我也很難在統計員和收益率之間纏繞我的頭腦。 class TrafficLight
include Enumerable
incl
如何返回IEnumerator的SortedDictionary(Of Integer, MyClass) 我有這個。 Dim dictionaryTest As New SortedDictionary(Of Integer, MyClass)
Dim enumerator As IEnumerator(Of Integer, MyClass) = dictionaryTest.GetEnum
Enum#feed 設置由內e。如果 值未設置的下一產量返回的值,收益回報nil.This值 正在產生後清零。 我試過一個例子,但它不是我認爲理解 #feed方法的那個例子。 a = [1,2,3,4].to_enum
p a.next #=> 1
a.feed 'foo'
p a.next #=> 2 , I expected here 'foo'
誰能給我一個很好的例子,瞭解如何#f
我必須使用枚舉器將傳入構造函數的float轉換爲基於浮點值(稱爲R)的字符串。它看起來是這樣的: static void Main(string[] args)
{
float R = 1;
<name of class> <object> = new <name of class> (R);
}
public class <name of clas