絶対値を返す関数

 マイナスが付いていれば、符号を取ってあげるだけなので、単純な関数です。

AppleScript

AppleScript

on Abs(x)
if x < 0 then return x * -1
return x
end Abs

あわせてこちらの記事もどうぞ

This entry was posted in AppleScript. Bookmark the permalink.

0 Responses to "絶対値を返す関数"