why can't this script be translated?
function BitAnd(Arg, Bit, n = 0, s = 0) =
let(Max = floor(ln(Arg)/ln(2)), m = 2^n/, _x = echo(Max, m, n, s)/)
n > Max ?
s :
BitAnd(Arg, Bit, n+1, s + m * (floor(Arg / m) % 2) * (floor(Bit /
m) % 2));
module Test(xx){
echo(xx);
}
left = 1;
module One(yy){
Test((BitAnd(yy, left) <> 0) ? 20: 30);
}
One(11);
Result: line 13 Parser error: syntax error
rr
On 12.08.22 11:51, rr156 wrote:
Test((BitAnd(yy, left) <> 0) ? 20: 30);
There is no "<>" only "!=".
ciao,
Torsten.
"<>" makes sense in many languages, but not in OpenSCAD. You need "!="
Jon
On 8/12/2022 5:51 AM, rr156 wrote:
function BitAnd(Arg, Bit, n = 0, s = 0) =
let(Max = floor(ln(Arg)/ln(2)), m = 2^n/, _x = echo(Max, m, n, s)/)
n > Max ?
s :
BitAnd(Arg, Bit, n+1, s + m * (floor(Arg / m) % 2) * (floor(Bit
/ m) % 2));
module Test(xx){
echo(xx);
}
left = 1;
module One(yy){
Test((BitAnd(yy, left) <> 0) ? 20: 30);
}
One(11);