Challenge 28

⬆️

Absolute Value

Open in Code Editor or Copy Instructions
...solutions at bottom of page...

Create a function that returns the absolute value of a number. The absolute value is the magnitude of the number, independent of the sign

Examples:

absolute(9) returns 9

absolute(-9) returns 9

absolute(-123.456) returns 123.456

Solutions

IGCSE 0478 / O-Level 2210 A-Level 9618