# Basic If Statement

**URL:** <https://forum.inductiveautomation.com/t/basic-if-statement/87410>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [March 15, 2024, 4:17pm UTC](https://forum.inductiveautomation.com/t/basic-if-statement/87410 "2024-03-15T16:17:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Crawford](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Ryan\_Crawford](https://forum.inductiveautomation.com/u/Ryan_Crawford)\
**Post date:** [March 15, 2024, 4:17pm UTC](https://forum.inductiveautomation.com/t/basic-if-statement/87410/1 "2024-03-15T16:17:43Z")

</div>

Good Morning,

Apologies for the confusion, but I'm just starting to grasp igigiton. I have a basic question: I'm aiming to achieve the following logic — if (A) is True, then set B to 10.

Have B set to a expression and A set to a bool.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/95fe8bee5053469ecf39106a6c0cdb1eb0daa88c.png)

If anyone can point me in the right direction that would be extremely helpful.

Thanks,

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [March 15, 2024, 4:20pm UTC](https://forum.inductiveautomation.com/t/basic-if-statement/87410/2 "2024-03-15T16:20:55Z")

</div>

You can't perform assignment in an expression with an equal sign.

Assuming `{[.]A}` is the correct path to `A`, I expect your expression should be

```auto
if({[.]A},10,0)

```

Since this expression is the value source of `B`, the result of the expression will be applied to `B` automatically.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 15, 2024, 4:22pm UTC](https://forum.inductiveautomation.com/t/basic-if-statement/87410/3 "2024-03-15T16:22:02Z")

</div>

You cannot assign a value like that. Expressions only return a value that gets applied to the tag the expression is in (in your case, B).

Try:  
`if({[.]A}, 10, 0)`

EDIT: @zacht beat me to it. 😉

---

<div class="post-metadata">

**Author:** ![Ryan\_Crawford](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Ryan\_Crawford](https://forum.inductiveautomation.com/u/Ryan_Crawford)\
**Post date:** [March 15, 2024, 4:24pm UTC](https://forum.inductiveautomation.com/t/basic-if-statement/87410/4 "2024-03-15T16:24:27Z")

</div>

Thank you very much. That clears it up.
