Dan Christian
2018-09-13 19:16:09 UTC
I want to select between multiple different configurations and want to
understand how to do that in a functional language.
In an imperative language I would do:
model = 'A';
if (model == 'A') {
dim_a = 1;
dim_b = 2;
} else if (model == 'B') {
dim_a = 3;
dim_b = 4;
} else { // default configuration
dim_a = 5;
dim_b = 6;
}
I may have many configurations and variables for each one. This simple
example could be done with ? :, but that gets super messy as things get
more complex.
What's the best way to do this in OpenScad?
Dan
understand how to do that in a functional language.
In an imperative language I would do:
model = 'A';
if (model == 'A') {
dim_a = 1;
dim_b = 2;
} else if (model == 'B') {
dim_a = 3;
dim_b = 4;
} else { // default configuration
dim_a = 5;
dim_b = 6;
}
I may have many configurations and variables for each one. This simple
example could be done with ? :, but that gets super messy as things get
more complex.
What's the best way to do this in OpenScad?
Dan