Here is the code:

for tact in 0...Int(tacts) { if tact != 1 || tact != 3 { print(tact) } 

}

As a result, prints all the bars and 0 and 1 and 2 and 3 and 4, etc. Does anyone know why?)

    1 answer 1

    You have a disjunction there. When tact is 1, it is not 3. When it is 3, it is not 1. Something is always executed.

    If you wanted 1 and 3 not to print, you need || replaced by &&:

     for tact in 0...Int(tacts) { if tact != 1 && tact != 3 { print(tact) } }