Edit: This is confirmed by apple as a compiler error.
The first if
expression below (17 terms) compiles, and produces the expected result (false
).
The second if
expression (18 terms) fails with the error message:
Cannot invoke '||' with an argument list of type '($T106,$T110)'.
The two expressions are identical except for the extra term.
I have no problem working around the problem, but I just don't understand what it is complaining about. Can someone enlighten me as to what stupid mistake I am making? Be gentle, very inexperienced coder here.
import Darwin
var a = -1
if
a == 0 ||
a == 1 ||
a == 2 ||
a == 3 ||
a == 4 ||
a == 5 ||
a == 6 ||
a == 7 ||
a == 8 ||
a == 9 ||
a == 10 ||
a == 11 ||
a == 12 ||
a == 13 ||
a == 14 ||
a == 15 ||
a == 16 ||
a == 17 { println("value was true") } else { println("value was false")}
if
a == 0 ||
a == 1 ||
a == 2 ||
a == 3 ||
a == 4 ||
a == 5 ||
a == 6 ||
a == 7 ||
a == 8 ||
a == 9 ||
a == 10 ||
a == 11 ||
a == 12 ||
a == 13 ||
a == 14 ||
a == 15 ||
a == 16 ||
a == 17 ||
a == 18 { println("value was true") } else { println("value was false")}
In mathematics, a limit is a value toward which an expression converges as one or more variables approach certain values. Limits are important in calculus and analysis. Consider the limit of the expression 2 x + 3 as x approaches 0.
The limit of a product is equal to the product of the limits. The limit of a quotient is equal to the quotient of the limits. The limit of a constant function is equal to the constant. The limit of a linear function is equal to the number x is approaching.
While the bug is solved you can use this:
switch a {
case 0...17:
println("value was true")
default:
println("value was false")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With