Search⌘ K

Solution Review: Absolute Value

Explore how to create a Dart function to compute the absolute value of a number by checking its sign and returning the positive equivalent. Understand using the ternary operator and if-else statements within function definitions to handle conditional logic in Dart. This lesson reinforces fundamental function implementation skills.

We'll cover the following...

Task

In this challenge, you had to create a function that computes the absolute value of a given number.

Solution

A skeleton of the function was already provided for you. Let’s look it over.

num
...