On 27.03.22 12:19, Jan Öhman via Discuss wrote:
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);
How about?
//degree0 = "bottom";
degree0 = "top";
deg0 = (degree0 == "bottom") ? 270
: (degree0 == "top") ? 90 : undef;
echo(degree0, deg0);
or maybe
//degree0 = "bottom";
//degree0 = "top";
degree0 = "";
deg0 = (degree0 == "bottom") ? 270
: (degree0 == "top") ? 90 : deg0;
echo(degree0, deg0);
It is hard to guess what you want to do when degree0 is neither top or
bottom.
On 27.03.22 12:19, Jan Öhman via Discuss wrote:
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)
that is just an artifact of echo. Echo adds the quotations marks around
a string.
with Kind regards,
Michael Frey
thanks!
yes! (ithis works!) ("undef" must be in the instruction)
// degree0 = "bottom";degree0 = "right";
deg0 = (degree0 == "left") ? 0 : (degree0 == "top") ? 90 : (degree0 == "right") ? 180 : (degree0 == "bottom") ? 270 : undef; echo(degree0, deg0);
Can not understand how this would add anything .:(I get an error message)
//degree0 = "bottom";//degree0 = "top";degree0 = "";
deg0 = (degree0 == "left") ? 0 : (degree0 == "top") ? 90 : (degree0 == "right") ? 180 : (degree0 == "bottom") ? 270 : deg0;
echo(degree0, deg0);
Den söndag 27 mars 2022 13:38:15 CEST, Michael Frey michael.frey@gmx.ch skrev:
On 27.03.22 12:19, Jan Öhman via Discuss wrote:
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);
How about?
//degree0 = "bottom";
degree0 = "top";
deg0 = (degree0 == "bottom") ? 270
: (degree0 == "top") ? 90 : undef;
echo(degree0, deg0);
or maybe
//degree0 = "bottom";
//degree0 = "top";
degree0 = "";
deg0 = (degree0 == "bottom") ? 270
: (degree0 == "top") ? 90 : deg0;
echo(degree0, deg0);
It is hard to guess what you want to do when degree0 is neither top or bottom.
On 27.03.22 12:19, Jan Öhman via Discuss wrote:
both this give the echo "left" (not left)
that is just an artifact of echo. Echo adds the quotations marks around a string.
with Kind regards,
Michael Frey
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org