November 2018
Beginner to intermediate
348 pages
8h 32m
English
We were introduced to the Class type when we were writing the ingestion code. This is the definition of Class:
type Class byteconst ( Ham Class = iota Spam MAXCLASS)
In other words, Ham is 0, Spam is 1, and MAXCLASS is 2. They're all constant values and can't be changed at runtime.
It would be prudent to note upfront, that there are limitations to this approach. In particular, it means that you have to know before running the program how many classes there will be. In our case, we know that there will be at most two classes: Spam or Ham. If we know there is a third class, say Prosciutto, for example, then we can code it as a value before MAXCLASS. There are many reasons for using a constant numerical value typed as a Class. Two of the ...
Read now
Unlock full access