vendredi 15 mai 2020

Can I have swift choose an integer for me?

Could I say something like:

var a :Int;
var b :Int;
var c :Int;

a > 0
b > 0
c > 0
a != b
b != c
a + b + c = 6

print(a)
print(b)
print(c)

Would this be possible? I want to print/return the numbers 1, 2, and 3 without repeating any of the numbers. Otherwise I assume I’ll have to generate a random number between 1 and 3 without repeating them.




Aucun commentaire:

Enregistrer un commentaire