Total Pageviews

Wednesday, April 9, 2014

តើអ្នកចូលចិត្តគណិតវិទ្យាអត់?

ប្រហែលជាមានការលំបាក់នៅពេលដែលរំលឹកអំពីគណិតវិទ្យាដែលបានរៀនពីមុន។
ចំណែកឡូអាគណិតវិញមានភាពងាយស្រួលទេ

ចាប់ផ្តើមមើលគណិតវិទ្យារបស់ឡូអាម្តងមើលះ
គណិតវិទ្យានៅក្នុងភាសាឡូអា
Power of Math នៅក្នុងភាសាឡូអាពិតជាអាចប្រើការបានច្រើន។ សូមមើលនៅស្តងដាររបស់ Math ដែលមាននៅ version 5.1 នៅក្នុង Math Lib

Math.abs()
វាជាហ្វាំងសិនដែលប្រើសំរាប់ ត្រឡប់មកវិញនៅតំលៃ Absolute value (magnitude) របស់ X

Syntax: math.abs(x)

X(តំរូវការ)វាជាចំនួនលេខ
សូមមើលកូដះ
local a = math.abs(153)        -- Sets a to 153
local b = math.abs(-15)        -- Sets b to 15
local c = math.abs(12.234)     -- Sets c to 12.234
local d = math.abs(-9.23)      -- Sets d to 9.23
local e = math.abs (1452)      -- Sets e to 1452

print ("math.abs")

No comments:

Post a Comment