# How to read return value of interface function in C++?

**URL:** <https://forums.unrealengine.com/t/how-to-read-return-value-of-interface-function-in-c/402235>\
**Category:** UI\
**Tags:** interface, value, return, unreal-engine, CPP, Blueprint, question\
**Created:** [August 18, 2017, 10:34pm UTC](https://forums.unrealengine.com/t/how-to-read-return-value-of-interface-function-in-c/402235 "2017-08-18T22:34:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Epok](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Epok](https://forums.unrealengine.com/u/Epok)\
**Post date:** [August 18, 2017, 10:34pm UTC](https://forums.unrealengine.com/t/how-to-read-return-value-of-interface-function-in-c/402235/1 "2017-08-18T22:34:48Z")

</div>

Hi,

I have declared an interface function which returns a boolean.

```
 UFUNCTION(BlueprintNativeEvent)
 bool CanPickup();

```

When I call the function I don’t understand how I am meant to read the value of the boolean being returned. The following interface call:

```
if (IBTWorldInteractionInterface::Execute_CanPickup(HoveredObject))
{
}

```

… returns the error:

```
error C2059: syntax error: 'if'
```

---

<div class="post-metadata">

**Author:** ![Epok](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Epok](https://forums.unrealengine.com/u/Epok)\
**Post date:** [August 19, 2017, 10:00am UTC](https://forums.unrealengine.com/t/how-to-read-return-value-of-interface-function-in-c/402235/2 "2017-08-19T10:00:01Z")

</div>

It is actually as simple as:

```
if (IBTWorldInteractionInterface::Execute_CanPickup(HoveredObject))
 {
 }

```

The line before where I checked if the object implemented the interface was missing a closing bracket, and therefore causing a compile error. Oops…

```
if (HoveredObject->GetClass()->ImplementsInterface(UBTWorldInteractionInterface::StaticClass()))
```
