Lesson help swift

2d

having a issue. I did everything as it says and its having trouble compiling. That being said I then opened the final product made by you guys. It had the same issue “Type ‘Int’ has no member ‘random’”

count = 0

var roll: Int = 0

repeat {

roll = Int.random(in: 1…6)

count += 1

// if count > 5 {

// break

// }

print(“After (count) roll(s), roll is (roll)”)

} while roll != 6 && count < 5

Reply

shogunkaramazovmoderator

2d

@lac_ekim What Xcode version are you using?

Reply

lac_ekim

2d

@shogunkaramazov Version 10.1 (10B61)

@lac_ekim Do you still have issues with this? It’s working fine for me.

yes, it differs from the lesson

roll = Int.random(in: 1…6) Type ‘Int’ has no member ‘random’

to be even more specific “Int.random(in: 1…6)”

understand this is directly from PS_2-03_End Playground

@shogunkaramazov figured it out, TY

This topic was automatically closed after 166 days. New replies are no longer allowed.