Exercise: Currency Converter
Explore how to build a simple currency converter function in Dart that accepts inputs for USD amount and exchange rate, performs a calculation, and returns the result. This lesson teaches function definition, parameter use, and return types, reinforcing function scope and clean code practices without using loops or conditional statements.
We'll cover the following...
We'll cover the following...
Problem statement
A travel finance app needs a reliable way to convert US Dollars (USD) into Euros (EUR). You need to create a dedicated function that takes the USD amount and the current exchange rate, calculates the final value, and returns the converted amount so it can be displayed to the user.