- From: carlosame via GitHub <sysbot+gh@w3.org>
- Date: Fri, 08 May 2020 23:15:27 +0000
- To: public-css-archive@w3.org
> origin of the switch is the "definition by cases"
Yes, cases on a single value/expression. But have you read the other proposal? Cases are independent conditions. Let's put it this way: which of the following two blocks of code looks more like a C _switch_:
```c
int mq;
switch (mq) {
case 1:
return value1;
case 2:
return value2;
case 3:
default:
return value3;
}
```
which is conceptually similar to my _switch_, or this:
```
grid-template-columns: switch(
(available-inline-size > 1024px) 1fr 4fr 1fr;
(--foo == 1) 2fr 1fr;
(--bar < 3) 1fr;
default 1fr;
);
```
This last block is valid according to the other "switch" syntax. I mean, there are multiple `<switch-condition> <css-value>` pairs, and nowhere says that `<switch-condition>` has to operate on the same variable nor with the same comparison operator.
--
GitHub Notification of comment by carlosame
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5009#issuecomment-626058948 using your GitHub account
Received on Friday, 8 May 2020 23:15:29 UTC