Guest User

Untitled

a guest
May 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. currencies: [GBP USD EUR NOK]
  2. cache: []
  3. <input id: amount value:: 0 />
  4. <input id: from value:: USD />
  5. <input id: to value:: GBP />
  6. <div>
  7. if $from/value not in $currencies or $to/value not in $currencies
  8. <span class: error>"Sorry, unknown currency symbol"</span>
  9. else
  10. if [$from/value $to/value] not in cache
  11. cache[$from/value $to/value]: get-remote-exchange-rate $from/value $to/value
  12. try
  13. amount-as-number: to-number $amount/value
  14. <span>$amount/value $from/value "=" (cache[$from/value $to/value] * amount-as-number) $to/value</span>
  15. catch
  16. <span>"Sorry, the value is not a number"</span>
  17. </div>
Add Comment
Please, Sign In to add comment