# is there a way to set one variable based on another in a module or function?

3 messages
Open this post in threaded view
|
Report Content as Inappropriate

## is there a way to set one variable based on another in a module or function?

 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: K7AZJRegistered Linux User: 275424Raspberry 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 [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|
Report Content as Inappropriate

## Re: is there a way to set one variable based on another in a module or function?

 b = !a;On 17 July 2017 at 15:54, Jerry Davis 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: K7AZJRegistered Linux User: 275424Raspberry 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 [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org