开发者

How do I define a range of floats?

开发者 https://www.devze.com 2023-01-14 09:35 出处:网络
I want to define a percentage type. TPrecent = 0 .. 100; works fine, but I can only assign integers to it an开发者_如何学编程 dwoudl also like to assign floats.

I want to define a percentage type.

TPrecent = 0 .. 100; works fine, but I can only assign integers to it an开发者_如何学编程 dwoudl also like to assign floats.

How can I do that?


Ranges can only be integer ordinal types. You will need to use a float variable and validate the value yourself.


TPercent is an integer sub-range. You cannot create a sub-range that is a floating point underlying type.

0

精彩评论

暂无评论...
验证码 换一张
取 消