# Can I use an If statement inside the header file?

**URL:** <https://forums.unrealengine.com/t/can-i-use-an-if-statement-inside-the-header-file/491329>\
**Category:** C++\
**Tags:** UProperty, header, unreal-engine, question\
**Created:** [November 26, 2021, 12:51am UTC](https://forums.unrealengine.com/t/can-i-use-an-if-statement-inside-the-header-file/491329 "2021-11-26T00:51:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tXxy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tXxy](https://forums.unrealengine.com/u/tXxy)\
**Post date:** [November 26, 2021, 12:51am UTC](https://forums.unrealengine.com/t/can-i-use-an-if-statement-inside-the-header-file/491329/1 "2021-11-26T00:51:03Z")

</div>

Hello, I am trying to make my variables public so I can use them in the details panel.  
I would like to create a few of them but hide them after a check.

```
UPROPERTY(EditAnywhere)
	bool ShowVariables;

	if (ShowVariables)
	{
		UPROPERTY(EditAnywhere)
		float speed = 90.f;
		UPROPERTY(EditAnywhere)
		float walkingSpeed = 70.f;
	}

```

The idea is that I click the checkbox in the Details panel and if the checkbox is clicked it then shows variables like speed, if I uncheck it, it hides them.  
Is something like this possible?  
I get an error saying I can not use the if because it expects a declaration of the if.

---

<div class="post-metadata">

**Author:** ![DevinSherry](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/devinsherry/32/1101099_2.png) [@DevinSherry](https://forums.unrealengine.com/u/DevinSherry)\
**Post date:** [November 26, 2021, 7:35am UTC](https://forums.unrealengine.com/t/can-i-use-an-if-statement-inside-the-header-file/491329/2 "2021-11-26T07:35:09Z")

</div>

I think what you need to use is the EditCondition meta data inside of the UPROPERTY()

 ![353072-editcondition.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/7/f5767b523acfbae7ebaaa5039349027792cf702f.png)

In your case it would be UPROPERTY(meta=(EditCondition = “ShowVariables”))

You can find more information here: [Properties | Unreal Engine Documentation](https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/GameplayArchitecture/Properties/).

I hope this helps 🙂

---

<div class="post-metadata">

**Author:** ![tXxy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tXxy](https://forums.unrealengine.com/u/tXxy)\
**Post date:** [November 26, 2021, 4:11pm UTC](https://forums.unrealengine.com/t/can-i-use-an-if-statement-inside-the-header-file/491329/3 "2021-11-26T16:11:47Z")

</div>

yes that was exactly what I was looking for thanks!
