2015-03-13 93 views
-2

我有以下代碼:錯誤CS0029不能隱式轉換int類型爲bool

GameObject g = Instantiate(gemPrefab,new 
isMatched = true; 
for (int i = 0; rows.Count; i++) 
    { 
     rows[i].isMatched = true; 
    } 
if (collumns.Count >= AmountToMatch) 
    { 
     isMatched=true; 
    } 
for(int i=0;collumns.Count;i++) 

不過,我得到以下錯誤:

error cs0029 cannot implicitly convert type int to bool (107,25) and (115,25)

我怎樣才能解決這個問題?

+0

cs2009似乎是一個C#錯誤消息,這是有道理的,因爲如果這是C++,它*應該*編譯,但仍然是錯誤的。 – 2015-03-13 16:18:56

回答

5

您在for(...)表達式中的條件需要是布爾表達式。

因此,而不是rows.Count,你的意思是什麼?可能i < rows.Count

第115行的表達也是如此。您需要i < collumns.Count

+0

非常感謝你)現在工作) – 2015-03-13 16:23:16

相關問題