A
A
Alexander B.2017-09-06 18:25:51
Swift
Alexander B., 2017-09-06 18:25:51

How to write a condition under which 3 variables are not equal to each other?

How to write a condition under which 3 variables are not equal to each other?
There are 3 variables hero, smoke and recycle.
I need them to be not all equal to each other, i.e. contained different values. How to describe it in a condition?
This is the code that doesn't work:

smoke != hero && smoke != recycle && recycle != hero

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Leonchik, 2017-09-06
@fury21

a = 1
b = 2
c = 3

if a != b && a != c && b != c
// все данные разные
end

L
Legebocker, 2017-09-06
@EnDeRJaY

Make the checking function a crutch "If-else". And also. Why do you need this? Explain the reason

A
arturios571, 2017-09-06
@arturios571

Instead of && you can (recommended) just write ","
State the problem in its entirety, otherwise the options above are quite suitable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question