| |
|
|
Michael W. | Hm, sees Yes bad from if since the Formatierung verbogen becomes, but I faith now is it discernible.
the ENUM has Yes meanwhile too Java heimgesucht, it'll means not only of me gladly used.
here an example for occupancy in XProfan. CompileMarkSeparation// -
enum eBoolean = eFalse, eTrue
// -
enum eJustify = eJustify_Left \/*0*/
eJustify_Center \/*1*/
eJustify_Right/*2*/
// -
enum eWeekdays = eWeekday_Sunday, \
eWeekday_Monday, \
eWeekday_Tuesday, \
eWeekday_Wednesday, \
eWeekday_Thursday, \
eWeekday_Friday, \
eWeekday_Saturday
// -
Declare eBoolean bTest
Declare eJustify lJustification
// -
bTest = eTrue
// -
Proc WDtoText
Parameters eWeekdays eDay
Var String Klartext = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"
Return SubStr(KlarText, eDay + 1, ",")// Rechnen mit ENUM
EndProc
// -
// Rechnen mit ENUM setzt die Konstante frei, alles OK
// Rechnen in ENUM-Var muß aber innerhalb der Grenzen eines ENUM bleiben; was passiert bei Überschreitung der Grenzen?
Declare eWeekdays eDay
Inc eDay
Dec eDay
// -
// Bewegen innerhalb von ENUM mittels enumMin() und enumMax()
<kleinster ENUM-Wert> = enumMin(<enumtype>)
<größter ENUM-Wert> = enumMax(<enumtype>)
// -
// erlaubt dann z.B. auch... (intern gesteuert)
ForEach eDay
Print WDtoText(eDay)
EndFor
// -
// oder... (hier müßte das FOR dann auch typisierte Variablen ermöglichen)
For eWeekdays eDay, enumMin(eWeekdays), enumMax(eWeekdays)
Print WDtoText(eDay)
EndFor
// -
// evtl. noch
TestEnum(eVal)
// whether the worth inside the border is.
Info: [...] |
|
|
| System: Windows 8/10, XProfan X4 Programmieren, das spannendste Detektivspiel der Welt. | 01/09/15 ▲ |
|
|
|
|
| where is the benefit in the comparison To:
var myColorsEnumVar=array("rot","grün","blond")
in link with ForEach... ? |
|
|
| |
|
|
|
Michael W. | I have aware a function between ForEach staid, so the klarer becomes. It's all right not simply around the Zuweisung. with ENUMs is another little More possible.
too CompileMarkSeparation shows already, the The values not always only ascending of 0 stored go. it can also new Startwerte (as here with fair) staid go.
I know the ENUM from Pascal (there heißt's Aufzählungstyp): CompileMarkSeparationtype
TAmpel = (rot = 1, gelb = 2, gruen = 4);
TArbeitstage = (Mo = 1, Di = 2, Mi = Mo + Di, Don = 4, Fr = Di + Mi);// Mi = 1+2=3, Fr = 2+3=5
TDoppelt = (Bez1 = 1, Bez2 = 2, Bez3 = 3, Bez4 = 2);// sowohl Bez2 als auch Bez4 ergeben mit Ord = 2pre> Inc/Dec/Ord functions there also (succ/pred)
loan from: [...] |
|
|
| System: Windows 8/10, XProfan X4 Programmieren, das spannendste Detektivspiel der Welt. | 01/09/15 ▲ |
|
|
|