# Expected an expression that can fail in the 'if' condition clause Error

**URL:** <https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [November 19, 2024, 4:37pm UTC](https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584 "2024-11-19T16:37:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stlouisj3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@stlouisj3](https://forums.unrealengine.com/u/stlouisj3)\
**Post date:** [November 19, 2024, 4:37pm UTC](https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584/1 "2024-11-19T16:37:33Z")

</div>

Why am I getting the error “Expected an expression that can fail in the ‘if’ condition clause” on my code. The condition can fail, so I am lost to why I am getting this error, especially since if I put the code in my Add Death function it works. Is it because I am not changing the value of lives? Any help would be appreciated.

AddDeath():logic=  
set lives -= 1  
return IsLastLife()

```
IsLastLife():logic=
    if(lives > 1):
        return false

    set TeamIndex -= 1
    return true
      
AddLife(e:int): void=         
    if(IsLastLife()):
        set TeamIndex += 1       
    set lives += 1

```

---

<div class="post-metadata">

**Author:** ![swaggod](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/swaggod/32/1051181_2.png) [@swaggod](https://forums.unrealengine.com/u/swaggod)\
**Post date:** [November 19, 2024, 11:25pm UTC](https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584/2 "2024-11-19T23:25:49Z")

</div>

Try `if(IsLastLife() = true): `

---

<div class="post-metadata">

**Author:** ![stlouisj3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@stlouisj3](https://forums.unrealengine.com/u/stlouisj3)\
**Post date:** [November 20, 2024, 5:28pm UTC](https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584/3 "2024-11-20T17:28:49Z")

</div>

Thanks but I figured it out, I had to initialize a new variable for it to work like this,  
AddLife(e:int): int= #Returns the new team index  
arg := IsLastLife()  
if(arg?):  
set TeamIndex += 1  
set lives += 1

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 20, 2024, 5:29pm UTC](https://forums.unrealengine.com/t/expected-an-expression-that-can-fail-in-the-if-condition-clause-error/2135584/4 "2024-12-20T17:29:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
