From the course: Introduction to Dart

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Solution: Volume of sphere

Solution: Volume of sphere - Dart Tutorial

From the course: Introduction to Dart

Solution: Volume of sphere

(upbeat digital music) - [Instructor] To get started with this solution, let's open our DartPad. First, I've created a function to calculate the volume of a sphere. To display the output, I've code the function in the print statement. This is possible because the calculate sphere volume function returns a double value. Now I will press the wrong button to execute the code and see the output. Congratulations. You have successfully written a function in Dart. We can test this code by changing the value of the radius and watching how the output changes.

Contents