Sorry for the noobish question. I want to understand how using the enums like
in C/C++
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
enum country {ITALY, GERMANY, PORTUGAL};
string capital[] = {"Rome", "Berlin", "Lisbon"};
cout<<capital[ITALY];
}
prints "Rome" as expected
type country = enum
ITALY=int(0),
GERMANY=int(1),
PORTUGAL=int(2)
var capital:array = ["Rome", "Berlin", "Lisbon"]
echo capital[ITALY] # error, "ITALY" is not equal to 0 !
The debugger prints a type mismatch. The only solution is to call ord()
function but the enum as declared as integers. Thank you in advance for your
indulgence.