# How to do division? With two variables?

**URL:** <https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 10, 2025, 8:53pm UTC](https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270 "2025-02-10T20:53:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![4venzor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@4venzor](https://forums.unrealengine.com/u/4venzor)\
**Post date:** [February 10, 2025, 8:53pm UTC](https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270/1 "2025-02-10T20:53:52Z")

</div>

Hey! I am trying to figure out how to divide by two variables in verse. When trying to divide them it gives me this error, “This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context. The ‘decides’ effect indicates that the invocation calls a function that might fail, and so must occur in a failure context that will handle the failure. Some examples of failure contexts are the condition clause of an ‘if’, the left operand of ‘or’, or the clause of the ‘logic’ macro”

The problem is with the calculation of Kd.

My Kd variable is = var KD : int = 0

```auto
showbillBoard(Agent : agent): void = 
        Print("Stats Check Stated.", ?Duration:=6.0)
        set elimations = elimationsTracker.GetValue(Agent)
        set playtime = PlayerTimeTracker.GetValue(Agent)
        set deaths = DeathTracker.GetValue(Agent)
        set wins = WinsTracker.GetValue(Agent)
        set KD = (elimations/deaths)

```

---

<div class="post-metadata">

**Author:** ![lantram](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lantram/32/977871_2.png) [@lantram](https://forums.unrealengine.com/u/lantram)\
**Post date:** [February 10, 2025, 10:54pm UTC](https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270/2 "2025-02-10T22:54:59Z")

</div>

> [@4venzor](#):
>
> `set KD = (elimations/deaths)`

Are they all floats? Or are you trying to do that with integers?

No errors in this:

```auto
var elimations:float = 1.0
var deaths:float = 2.0
var KD:float = 0.0
...
set KD = (elimations/deaths)

```

---

<div class="post-metadata">

**Author:** ![ok\_studios](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ok\_studios](https://forums.unrealengine.com/u/ok_studios)\
**Post date:** [February 11, 2025, 7:19am UTC](https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270/3 "2025-02-11T07:19:13Z")

</div>

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/7/b478cedb91b3a1b7b3e75be56339ff57133caf1b.jpeg "Division in the Verse Programming Language: How to Determine if a Number is Even or Odd") ](https://www.youtube.com/watch?v=jDKa1XWhDE8)

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [February 11, 2025, 10:07am UTC](https://forums.unrealengine.com/t/how-to-do-division-with-two-variables/2326270/4 "2025-02-11T10:07:47Z")

</div>

Integer divisions can fail since you could try to divide by 0, thus you need to handle the failure

> **[Rational in Verse | Unreal Editor for Fortnite Documentation | Epic Developer...](https://dev.epicgames.com/documentation/en-us/uefn/rational-in-verse)**
>
> The rational type is used as the result of integer division.

You can use floats otherwise, since division by 0 is handled by the NaN value
