abs()

計算輸入的絕對值。

語法

abs(x)

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
x int、real 或 timespan ✔️ 要設為絕對的值。

傳回

x 的絕對值。

範例

print abs(-5)

輸出

print_0
5