+ 1
Swift problem
Well, how do you use "&&" and "!=" on the same line in swift? I was solving a code coach problem when I encountered that problem. In the attached code is a snippet of what the problem is. That code is valid in other languages. Like if I want to check for a number that is a multiple of 2 but not 4, I should be able to do it as Let a = 6 if (a%2==0 && a%4!=0) //do something This code doesn't work in swift. It throws an error about && and != appearing on the same line or something along that line. https://code.sololearn.com/cev43yWWMnIF/?ref=app
2 Answers
+ 2
it should work, but you didn't put any spaces between operators and values.
(a > 3 && a != 8) not (a>3 && a!=8)
+ 3
Bahha🐧 Thanks man. That worked. Swift is really strict with spaces😣😣
Hot today
Python — File Handling
1 Votes
Help me solve this (using loop)
3 Votes
What is wrong? Error on test.
1 Votes
Help me wiht python
1 Votes
Help me
0 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
What’s wrong?
2 Votes