Define a primitive data type: Difference between revisions

Added Scala
m (Added bc, dc and Vim Script to omission list)
(Added Scala)
Line 1,239:
assert_raise(ArgumentError) { c = a + b } # => invalid value '12', must be an integer
assert_raise(ArgumentError) { c = b - a } # => invalid value '-2', must be an integer</lang>
 
=={{header|Scala}}==
[[Category:Scala Implementations]]
{{libheader|Scala}}<lang Scala>class TinyInt(val int: Byte) {
val (lower, upper) = (1, 10)
require(int >= lower && int <= upper, "TinyInt out of bounds.")
}
 
object TinyInt {
def apply(i: Byte) = new TinyInt(i)
}</lang>
 
=={{header|Tcl}}==
Anonymous user