Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. Include all bounds checking you need to write, or explain how the compiler or interpreter creates those bounds checks for you.

type
  MyInt = range[1..10]
 
var x: MyInt = 5
 
x = x + 6  # Runtime error: unhandled exception: value out of range: 11 notin 1 .. 10 [RangeDefect]
 
x = 12     # Compile-time error: conversion from int literal(12) to MyInt is invalid