< Dice‎ | BuiltinFunctions
Revision as of 21:48, 27 April 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|BuiltinFunction.Round Method (FunctionContext)}} Rounds the argument. {{ns}} == Syntax == <syntaxhighlight lang="C#"> [DiceFunction("round", Scope = FunctionScope.G...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

BuiltinFunction.Round Method (FunctionContext)

From DiceRoller Documentation

Rounds the argument.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Syntax

[DiceFunction("round", Scope = FunctionScope.Global)]
public static void Round(
    FunctionContext context
)

Parameters

context
Type: Dice.FunctionContext
The context of the function call.

Exceptions

Exception Condition
DiceException (DiceErrorCode.IncorrectArity) context.Arguments.Count is not exactly 1.
DiceException (DiceErrorCode.IncorrectArgType) context.Arguments[0] is a comparison.

Remarks

This function rounds to the nearest integer. Values of exactly .5 are rounded away from zero (1.5 rounds to 2, -2.5 rounds to -3).