Τρίτη 4 Σεπτεμβρίου 2018

Revision 15 Version 9.4

From 9.4 version M2000 have Enumerations. An enumeration is a list of variables which are of same type, the name of enumeration. We can use any numeric type for value, and we can set one or more to desired value. Variables of enumeration list are read only, and by default are local, where we define them.
We can defined variables by using for a value an enumeration variable.. These variables can change values, using another enumeration variable, or by using ++ to change to successor, or stay there if no more value exist, and --to found previous values, and stop at the first value.
Function Len() show the distance from first value, so Len(a)=0  where a belong to an enumeration list, means that a is the first value. We can't vhange value giving a value from other enumeration list.

We can use Each(enum_variable) to make an iterator. We can use Eval$(enim_variable_or_iterator) to get name of read only variable, and with Eval(enum_variable_or_iterator) we get the value of variables. Also we get the value in an expression/

We can define type of enumeration for an argument, by value or by reference. Name of type  is case sensitive, and get the case as we defined in enum structure. We can use Enum or Enumeration. We  can use a list in one line using comma or we can insert lines between variables.
We can use  Enum {Dog, Cat}



\\ by default Dog=1, Cat=2
\\ we can change it: Dog=0, Cat   ' so now Cat=1
\\ we can change it: Dog=100, Cat=200
\\ we can put a new line in place of comma
\\ or after comma,
\\ we can't leave a comma as last character except new lines, in the enum block.
Enumeration Pets {
      Dog
      Cat
}
a=Dog
Print a=1 ' true
a++
Print Eval$(a)="Cat", a=2
k=Each(Pets)
While k {
      Print Eval$(k), Eval(k)
      a=Eval(k)
      Print a<Cat
      Alfa(a)
}
a=Dog
AlfaByRef(&a)
Print a=Cat

Sub Alfa(b as Pets)
      Print b
End Sub
Sub AlfaByRef(&b as Pets)
      Print b
      b++
End Sub

And with Greek statements
Μπορούμε να χρησιμοποιήσουμε το Απαρ Κατοικίδια {Σκύλος, Γάτα}


\\ Εξ ορισμού Σκύλος=1 και Γάτα=2
\\ Μπορούμε να δώσουμε τ ο Σκύλος=0, Γάτα και το Γάτα θα γίνει 1
\\ ή Σκύλος=100, Γάτα=200
\\ αντί για κόμμα μπορούμε να αλλάζουμε γραμμή
\\ ή μπορούμε να βάζουμε  αλλαγή γραμμής μετά το κόμμα
\\ δεν μπορούμε να αφήσουμε ένα κόμμα στο τέλος
Απαρίθμηση Κατοικίδια {
      Σκύλος
      Γάτα
}
α=Σκύλος
Τύπωσε α=1 ' αληθές
α++
Τύπωσε Εκφρ$(α)="Γάτα", α=2
κ=Κάθε(Κατοικίδια)
Ενώ κ {
      Τύπωσε Εκφρ$(κ), Εκφρ(κ)
      α=Εκφρ(κ)
      Τύπωσε α<Γάτα
      Αλφα(α)
}
α=Σκύλος
ΑλφαΜεΑναφορά(&α)
Τύπωσε α=Γάτα

Ρουτίνα Αλφα(β ως Κατοικίδια)
      Τύπωσε β
Τέλος Ρουτίνας
Ρουτίνα ΑλφαΜεΑναφορά(&β ως Κατοικίδια)
      Τύπωσε β
      β++
Τέλος Ρουτίνας

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου

You can feel free to write any suggestion, or idea on the subject.