I have been trying to figure out a clean way of doing this:
lets say I have 2 variables. The premise is that when one of them is set to
true, the other has to be set to false and vice versa.
So functionally:
a = true;
b = false;
is there a function or module that can be written, such that if a is set to
true, then b will be set to false? and if a is set to false, b will be set
to true?
or do I have to always visually check?
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Openscad developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
b = !a;
On 17 July 2017 at 15:54, Jerry Davis jdawgaz@gmail.com wrote:
I have been trying to figure out a clean way of doing this:
lets say I have 2 variables. The premise is that when one of them is set
to true, the other has to be set to false and vice versa.
So functionally:
a = true;
b = false;
is there a function or module that can be written, such that if a is set
to true, then b will be set to false? and if a is set to false, b will be
set to true?
or do I have to always visually check?
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Openscad developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
b = !a is the simplest solution in this specific case. More generally, you
can use the ternary operator to set variables conditionally. For an (overly
verbose) example:
b = (a == true) ? false : true;
On July 17, 2017 at 07:55:20, Jerry Davis (jdawgaz@gmail.com) wrote:
I have been trying to figure out a clean way of doing this:
lets say I have 2 variables. The premise is that when one of them is set to
true, the other has to be set to false and vice versa.
So functionally:
a = true;
b = false;
is there a function or module that can be written, such that if a is set to
true, then b will be set to false? and if a is set to false, b will be set
to true?
or do I have to always visually check?
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Openscad developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org