Coding challenge
Mark Wieder
mwieder at ahsoftware.net
Wed Jan 30 23:19:37 EST 2013
Here's the one I came up with:
function makeChange pValue
local tChange
set the itemdelimiter to comma
repeat for each item tCoin in "50,20,10,5,2,1"
repeat while pValue >= tCoin
put tCoin & comma after tChange
subtract tCoin from pValue
end repeat
end repeat
return char 1 to -2 of tChange
end makeChange
And for 74 I get 50,20,2,2
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list