tags:

views:

126

answers:

2

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?

+5  A: 

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

Allen Bauer
+4  A: 

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

Ignacio Vazquez-Abrams
Subranges can be ordinal types (integer, character, enumerated): http://docwiki.embarcadero.com/RADStudio/en/Simple_Types
TOndrej
Right, ordinal. It's been a while...
Ignacio Vazquez-Abrams