Calc Test Page

From Distillers Wiki
Revision as of 16:04, 17 November 2022 by Single Malt Yinzer (talk | contribs) (More documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sample code test Calc e^43 = 4.7278394682294E+18

Simple Math test Calc2 2*3 = 6


#vardefine creates the variable & gives it a value.
#var allows you to use it. you need to use it like {{#var:X}}
{{#var:X}} by itself will print the value of the var
To do a calculation you need to use {{#expr:equation}} - this will also print the value of the expression.
Check the source of the page for examples.






Using Variables test calc 6




15
This is PHP code for a calculator

<?php if(isset($_POST['sub'])){ $num1=$_POST['n1']; $num2=$_POST['n2']; $oprnd=$_POST['sub']; if($oprnd=="+") $ans=$num1+$num2; else if($oprnd=="-") $ans=$num1-$num2; else if($oprnd=="x") $ans=$num1*$num2; else if($oprnd=="/") $ans=$num1/$num2; }?>




Links to useful pages
https://t4tutorials.com/simple-calculator-using-php/
https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions
https://www.mediawiki.org/wiki/Extension:Variables