let Code Coach: Popsicles in Swift 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

let Code Coach: Popsicles in Swift 4

Does anyone tried and finished the Easy Code Coach Popsicles in Swift 4? I don't want you to post the code, because I already done Popsicles in all languages except Ruby which I'm learning now and Swift 4 which I finished earlier. But, Swift 4 is a horror programming language as I said in many comments throughout the SL course. So, I used readLine()! for getting the input (SL not even mention this function). Also, I used guard for the inputs and return to exit the guard. There I have an error, after I resolved many others. Again, Swift 4 is horror... like an Apple product.

24th Dec 2021, 8:29 PM
Romeo Cojocaru
Romeo Cojocaru - avatar
2 Answers
+ 2
Romeo Cojocaru I've lost your message. But your first both input lines are right. Then use only if/else. And look at this: if (variableA! % variableB! == 0) { Do you see these "!" 😉
25th Dec 2021, 9:22 AM
Coding Cat
Coding Cat - avatar
+ 1
Yes, I did it just now. W/o knowing swift. Needed some tryes. Input with readLine() converted to Int and declared as not nil. Modulo comparisation the same: Both variables declared as not nil.
24th Dec 2021, 10:58 PM
Coding Cat
Coding Cat - avatar