# Range types (design/input.md, 2026-09-20): a type with bounds, provably within them.structPercent{value:uint8[min0,max100]}fnscale['p':Percent,'total':int32[min0,max1000]]->int32[min0,max1000]{return('total'timesto.int32['p'.value])div.floor100;}MAIN{let'half':=Percent[value=50];std::print.useful[scale[give'half',800],newln];let'raw':=250;if'raw'at_least0and'raw'at_most100{let'ok':int32[min0,max100]='raw';# the if is the guardrail; a check sitestd::print.useful['ok',newln];}else{std::print.stored["250 is not a percentage",newln];}let'r':=to.uint8[min0,max100]["42"]otherwise0;# into a range type: fails, does not checklet'bad':=to.uint8[min0,max100]["142"]otherwise0;let'huge':=to.uint8[min0,max100]["99999999999"]otherwise0;# not even a uint8: still out of range, not a crashstd::print.useful['r'," ",'bad'," ",'huge',newln];let'unit':bin64[min0.0,max1.0]=0.25;std::print.useful['unit',newln];}