-5
,我在一個iOS的課程,跨這個錯誤來,同時使我的應用程序:預計申報錯誤(while循環)
import Foundation
import UIKit
class RootsCateogry1: ViewController {
@IBOutlet weak var roots1Label: UILabel!
var rootsWeek1 = ["acro", "micro"]
var rootsWeek1Meaning = ["Air", "Small"]
var roots1Show = []
var temp = rootsWeek1.count // error here
var p = 0
var i = 0
while(i<temp){ // error here
roots1Show.append(rootsWeek1temp)
temp++
}
// ...
}
將來,請在問題中添加代碼,而不是屏幕截圖。它可以幫助人們找到解決方案! – Ollie
看起來您已經忘記添加'viewDidLoad'函數,只需將代碼(從'var rootsWeek ...'到''while''子句的末尾)包裹起來,它應該從那裏開始工作。 – Ollie