dimanche 3 mai 2020

Save the value of a variable even if you change its value later in Swift

I'm working a bit with swift and I have problems with saving the value of a variable. I have e that generates a random number in a range from 0 to 5:

let e = Int.random(in: 0...5)

And I also have another variable i that generates a random number in a range from 1 to 10:

let i = Int.random(in: 1...10)

I would like to save the value that has i in another variable when e equals 0 regardless of e changing again. How can I do it?




Aucun commentaire:

Enregistrer un commentaire