Having two conditions cannot, only one is possible which is the middle, as you may already know. But you can use the ||
or other operators, several times. It will still have a condition, but the expression can be much more complex, what matters is that in the end it results in a Boolean. Then you can have several comparative expressions linked by relational operators.
Except in your case it doesn’t make sense, it’s impossible index
be less than tam
, after all it was declared valid 0
just before and tam
is a size that cannot be less than 0
. You could make it that simple:
for (let index = 0; index < entrada.length; index++)
I put in the Github for future reference.
It doesn’t make sense, and it’s usually worse, to get the size out of the loop. There are other very weird and probably wrong things in this code.
It seems to me that the correct situation should be to use a While. ie, while X condition OR Y condition is true executes the code. I think that’s more what you want.
– Luís Almeida
Yes you can do that, but you have to define the parity variable outside the cycle for.
– lazyFox