Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- currencies: [GBP USD EUR NOK]
- cache: []
- <input id: amount value:: 0 />
- <input id: from value:: USD />
- <input id: to value:: GBP />
- <div>
- if $from/value not in $currencies or $to/value not in $currencies
- <span class: error>"Sorry, unknown currency symbol"</span>
- else
- if [$from/value $to/value] not in cache
- cache[$from/value $to/value]: get-remote-exchange-rate $from/value $to/value
- try
- amount-as-number: to-number $amount/value
- <span>$amount/value $from/value "=" (cache[$from/value $to/value] * amount-as-number) $to/value</span>
- catch
- <span>"Sorry, the value is not a number"</span>
- </div>
Add Comment
Please, Sign In to add comment