+ 1
Why this code doesn't work?
When i do this lesson Sololearn shows an error But when i test this code in XCode playground, it works correctly let siblings = 3 let popsicles = 9 if (popsicles % siblings) == 0 { print("give away") } else { print("eat them yourself") }
3 Answers
+ 2
You should get the variables from inputs.
+ 2
let siblings = Int(readLine(strippingNewline: true)!)!
let popsicles = Int(readLine(strippingNewline: true)!)!
if (popsicles % siblings == 0) {
print("give away")
} else {
print("eat them yourself")
}
+ 1
please can you explain in more detail? I don't understand, why here it doesn't work