SA-MP Forums Archive
Why There's Such a difference? [Enums] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: General (https://sampforum.blast.hk/forumdisplay.php?fid=13)
+--- Thread: Why There's Such a difference? [Enums] (/showthread.php?tid=591380)



Why There's Such a difference? [Enums] - TheRaGeLord - 11.10.2015

I would like to ask that why is there such a difference in enums in Pawn and C/C++? I heard that Pawn is made from C, then Why in Pawn we use 'Enums' as kind of Variables, but in C/C++ there's a big difference

In Pawn:

Код:
enum Person
{
   Money,
   Age
};

new hBeing[playerid][Person];

// then we use it as
hBeing[playerid][Money]=1000;
But in C++

Код:
enum Color
{
  red,
  green,
  blue
}

// then we use it as
Color x=red;// or enum Color x=red; (in C I think?)
Why is there so much difference, Or am I mistaken somewhere?


Re: Why There's Such a difference? [Enums] - Infinity - 11.10.2015

They are the same, but you just used them in different cases. Enumerators are nothing but a clean way to assign a simple value or index to something. Common use is indeed to index arrays in a more readable format.

Also, this doesn't really belong in "General", does it..?


Re: Why There's Such a difference? [Enums] - TheRaGeLord - 11.10.2015

Kk Thanks.

And Please Move This Topic to uhmm I think Scripting Help..