April 06, 2020 switch case range inclusive or exclusive? | ||||
---|---|---|---|---|
| ||||
In the D spec it says for CaseRangeStatement: https://dlang.org/spec/statement.html#CaseRangeStatement > A CaseRangeStatement is a shorthand for listing a series of case statements from FirstExp to LastExp. does this mean LastExp is inclusive or exclusive part of the range? I think the spec needs to be improved a little bit here for clarity. |
April 06, 2020 Re: switch case range inclusive or exclusive? | ||||
---|---|---|---|---|
| ||||
Posted in reply to WebFreak001 | On 4/6/20 5:50 AM, WebFreak001 wrote:
> In the D spec it says for CaseRangeStatement:
> https://dlang.org/spec/statement.html#CaseRangeStatement
>
>> A CaseRangeStatement is a shorthand for listing a series of case statements from FirstExp to LastExp.
>
> does this mean LastExp is inclusive or exclusive part of the range?
>
> I think the spec needs to be improved a little bit here for clarity.
Inclusive. It's as if you typed all the case statements out between them.
I agree, it could be clearer, if you just added ", including LastExp"
-Steve
|
Copyright © 1999-2021 by the D Language Foundation