Her deyimin kaç kez kullanıldığı bir anahtar deyimi kullanmaya çalışıyorum. Şimdiye kadar ardışık ifadelerle ilgili bir sorun yaşıyorum ";" ile ayrılmalıdır Hatayı kontrol ettim ve şu ana kadar bulabildiğim tek şey, kapalı parantezlerle ilgili bir sorun olduğudur, ancak tüm parantezlerim kapalı gibi görünüyor.Bir durumdan anahtar durumu bildirimi
func switchInt() -> Array<Int> {
var switchAr = [Int]()
var lowSwitch = 0
var medSwitch = 0
var highSwitch = 0
for _ in 1...10 {
let switchInt = Int(arc4random_uniform(100))
switch switchInt {
case 0...35:
return lowSwitch +=1
switchAr.append(switchInt)
case switchAr 35<=67:
medSwitch +=1
switchAr.append(switchInt)
case switchAr 70<=100:
highSwitch; +=1
switchAr.append(switchInt)
default:
print("does not compute")
}
}
return(switchAr)
}
artırmak için birkaç değişiklik yaptık notu neredeyse doğru ilk durum var ve her şey karışacak var bundan sonra. – nhgrif
'highSwitch; + = 1' 'HighSwitch + = 1' olarak değiştirin –