# "Item is null" despite if(item)

**URL:** <https://discourse.codecombat.com/t/item-is-null-despite-if-item/5131>\
**Category:** Uncategorized\
**Created:** [October 4, 2015, 7:35pm UTC](https://discourse.codecombat.com/t/item-is-null-despite-if-item/5131 "2015-10-04T19:35:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [October 4, 2015, 10:44pm UTC](https://discourse.codecombat.com/t/item-is-null-despite-if-item/5131/6 "2015-10-04T22:44:20Z")

</div>

> [@J\_F\_B\_M](#):
>
> Actually I think this is a pretty uncommon problem. Most people do not tend to place semicoli in places where they are syntactically correct but semantically nonsense. And even less people place a semicolon in a place where it actually changes the semantic.

That is true.

Perhaps I didn’t express myself well. I meant that I believe the specific “semicolon between a control flow statement and a block statement” issue to be a common one as virtually every developer has made this mistake sometime in their lives. And this often happens at the very beginning of their learning. That is why I replied with a simple “how to fix it” answer rather than a very detailed one that may overload their beginner programming minds. Borrowing Nick’s words:

> [@Level: A Mayhem of Munchkins Help](https://discourse.codecombat.com/t/level-a-mayhem-of-munchkins-help/4909/3):
>
> The act of fixing the code is way better for learning than anything else.

(Note: I actually find your answer very comprehensive, detailed and easy to understand, but a complete beginner may find otherwise. Either way, it will be there in case they want to revisit it in the future. It also provides useful insight that helps actually understanding the programming language syntax.)

As for how common this issue really is nowadays, I’m not sure but take in consideration that one of the main reasons for the rise of the [OTBS](https://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS) and [Stroustrup](https://en.wikipedia.org/wiki/Indent_style#Variant:_Stroustrup) coding styles is that putting the opening curly brace in the same line as the control flow statement makes it harder to accidentally insert an unwanted semicolon between them.

---

_[View the full topic](https://discourse.codecombat.com/t/item-is-null-despite-if-item/5131)._
