Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

This is a list of commonly used functions in the code portion of the Editor. If you have any questions about how they operate feel free to email us.

 

Function nameDescriptionArgument typeReturn typeExampleDefault answerAlternate answer(s)
aOrAn(num,true/false)Returns "A" or "An" for the number when "true". Returns "a" or "an" as appropriate for the given number when "false" (or when true/false is excluded).number and true/falsestring

aOrAn(3,true)

aOrAn(8,false)

"A"

"an"

 
oRandom(min1,max1,min2,max2,sigfig,def)Returns a number either between min1 and max1 or min2 and max2 with the specified number of significant digitsnumbersdoubleoRandom(1, 1.5, 3, 3.5, 3, 1)11.25, 3.3, many others
randomStep(min,max,step,def)Generates a random numbernumbersdoublerandomStep(1, 5, 1, 3)31, 2, 4, 5
reducedFrac(a,b)Reduces a/b to simplest formint or doublechar*reducedFrac(12,6)2 
roundoff(num, precision)

Rounds off a number

Note: drops trailing zeros

numbersstring or double

roundoff(4.056, 3)

x=4.02 roundoff(x, 2)

4.06

4

 
sigfig(num, precision)Rounds off a number.numbersstring

sigfig(4.056, 3)

x=4.02 sigfig(x, 2)

4.06

4.0

 
       
       
       

 


 

  • No labels