Anonymous user
Define a primitive data type: Difference between revisions
m
→{{header|Dyalect}}
Thundergnat (talk | contribs) m (→{{header|C sharp}}: Regularize header markup to recommended on category page) |
|||
Line 534:
The code below defines a new type <code>TinyInt</code>, provides bounds checking and implementation of all standard arithmetic operators:
<lang dyalect>type TinyInt =
func Integer.
static func TinyInt.TinyInt(Integer x) {
throw
}
func TinyInt.
func TinyInt.
func TinyInt + (other) => TinyInt(this
func TinyInt * (other) => TinyInt(this
func TinyInt - (other) => TinyInt(this
func TinyInt / (other) => TinyInt(this
Sample usage (interactive session):
|