+ 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") }

9th Apr 2021, 4:51 PM
Игорь Щербак
Игорь Щербак - avatar
3 ответов
+ 2
You should get the variables from inputs.
9th Apr 2021, 5:15 PM
JaScript
JaScript - avatar
+ 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") }
9th Apr 2021, 7:25 PM
JaScript
JaScript - avatar
+ 1
please can you explain in more detail? I don't understand, why here it doesn't work
9th Apr 2021, 5:19 PM
Игорь Щербак
Игорь Щербак - avatar