I have problem to use the "if" instruktion in openSCAD.
1) My wish is - if the variable degree0 contains a value (the text eg. bottom), I want the variable deg0 get the value 270.and if the variable degree0 contains a value (the text eg. top), I want the variable deg0 get the value 90 (and so on - the degree0 may contain right / top / left / bottom)
Tried a bit, but failed
// degree0 = "bottom";degree0 = "top";
// if (degree0 == "bottom") deg0 = 270;// if (degree0 == "top") deg0 = 90;
// degree0 = "bottom" ? deg0 = 270;// degree0 = "top" ? deg0 = 90;
degree0 = "bottom" ? deg0 = 270 : degree0 = "top" ? deg0 = 90;
echo(degree0, deg0);
2)I don't understand how to give variable degree0 the text left (not "left")two examples.
degree0 = "left";echo(degree0);
or
degree0 = str("left");
echo(degree0);
both this give the echo "left" (not left)