Subrange type

Herbert ht at softdesign.de
Mon Jan 27 21:15:58 UTC 2020


On Monday, 27 January 2020 at 20:15:33 UTC, Steven Schveighoffer 
wrote:
> On 1/27/20 3:06 PM, Herbert wrote:
>> How can I create a subrange type, for example ushort DiceValue 
>> {1 ... 6}?
>
> D doesn't have a "Range" type like this. But you can use ranges 
> of different types by typing the literals. Note that D numeric 
> ranges are always exclusive at the upper end.
>
> e.g.:
>
> ushort(1) .. ushort(6+1)
>
> -Steve

Thank you Steven!

How can I have a function parameter with this type (DiceValue)?



More information about the Digitalmars-d-learn mailing list