Define a primitive data type: Difference between revisions

add language: Retro
(add language: Retro)
Line 925:
<class '__main__.num'>
>>></lang>
 
=={{header|Retro}}==
<lang Retro>{{
variable update
---reveal---
: .limited @update &! &@ if update off ;
: to dup 1 10 within [ update on ] [ drop "Out of bounds\n" puts ] if ;
: limited: create 1 , &.limited reclass ;
}}</lang>
 
This creates a data element that returns a value from 1 to 10. Alteration of the value is possible using '''to'''.
 
<lang Retro>limited: foo
1 to foo
foo .s
51 to foo
foo .s
bye</lang>
 
=={{header|Ruby}}==
Anonymous user