diff --git a/examples/usd_to_euro/main.aspl b/examples/usd_to_euro/main.aspl new file mode 100644 index 0000000..1ebbbae --- /dev/null +++ b/examples/usd_to_euro/main.aspl @@ -0,0 +1,10 @@ +import internet +import json +import math + +var usd = math.round(double(input("Enter a value of $ you want to convert to €: ")), 2) +var data = map(json.decode(internet.get("http://open.er-api.com/v6/latest/USD").text)) // TODO: Use https here when it works +var rates = map(data["rates"]) +var rate = rates["EUR"] +var euro = math.round(usd * rate, 2) +print(usd + "$ ≙ " + euro + "€") \ No newline at end of file