XtScript Function: pi
Return the value of PI, The ratio of the radius of a circle to its circumference.
XtScript's pi is a function that will return the pi (π) value, a constant number in mathematic which is the ratio of the circumference of a circle to its diameter.
pi function has no argument passed in it.
XtScript pi function basic syntax:
<!--parser:xtscript--> call pi <!--/parser:xtscript-->
Learn XtScript pi function from examples
Use the pi (π) value in a mathematic operation.
- Code:<!--parser:xtscript--> # Assigning pi into a variable var $pi = call pi print If a circle has 30 m diameter, the formula to calculate the circumference is <var>C = π x d</var>, then the circle circumference will be: <br/> print C = $pi x 30 = ($pi * 30) m <!--/parser:xtscript-->- Result:
If a circle has 30 m diameter, the formula to calculate the circumference is C = π x d, then the circle circumference will be:
C = 3.1415926535898 x 30 = 94.247779607694 m
C = 3.1415926535898 x 30 = 94.247779607694 m
Last edited on