mirror of
https://github.com/dlang-community/dfmt.git
synced 2025-04-25 21:00:03 +03:00
8 lines
No EOL
134 B
D
8 lines
No EOL
134 B
D
int abs(int x) {
|
|
if (x < 0)
|
|
// x negative, must negate
|
|
return -x;
|
|
else
|
|
// x already non-negative, just return it
|
|
return x;
|
|
} |