RosettaCodeData/Task/Roman-numerals-Encode/SenseTalk/roman-numerals-encode-1.sensetalk
2023-07-01 13:44:08 -04:00

27 lines
575 B
Text

function RomanNumeralsEncode number
put [
(1, "I"),
(4, "IV"),
(5, "V"),
(9, "IX"),
(10, "X"),
(40, "XL"),
(50, "L"),
(90, "XC"),
(100, "C"),
(400, "CD"),
(500, "D"),
(900, "CM"),
(1000, "M")
] into values
repeat for index = each item of (the number of items in values)..1
put item index of values into pair
repeat while number is greater than or equal to the first item of pair
put the second item of pair after numerals
subtract the first item of pair from number
end repeat
end repeat
return numerals
end RomanNumeralsEncode