# (Solved) Burlbole grove(JAVA)

**URL:** <https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364>\
**Category:** Uncategorized\
**Created:** [September 6, 2017, 12:34am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364 "2017-09-06T00:34:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oGREzok](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ogrezok/32/6910_2.png) [@oGREzok](https://discourse.codecombat.com/u/oGREzok)\
**Post date:** [September 6, 2017, 12:34am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/1 "2017-09-06T00:34:52Z")

</div>

Hello, community, been stuck on this SUBJ level, googled, and tried youtube, nothing helped.  
Will break it into two parts, function and execution.  
First of all, there was no lesson on ‘NOT operator’, but from googling I’ve realized in real JAVA it’s" !="  
when I’ve tried using != gives me mistakes, looked up in hints, and there just only “!” sign

so here’s my function logic:

```
// if there's no !taget return false 
//but if there's target beast burl, retuns false (don't touch him)    
//otherwise if something else returning true

```

```python
function shouldAttack(target) {
    if (!target) {
        return false;
   
    if (taget.type == "burl");
        return false;
    
    } else {
        return true;
    }
}

```

tnx for your replies

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [September 6, 2017, 1:54am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/2 "2017-09-06T01:54:00Z")

</div>

There is a typo on Line 5 (`target`, not `taget` 😉), as well as an incorrectly placed semicolon. Where is the identifier? 😉

Other than that, it looks good 🙂

---

<div class="post-metadata">

**Author:** ![oGREzok](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ogrezok/32/6910_2.png) [@oGREzok](https://discourse.codecombat.com/u/oGREzok)\
**Post date:** [September 6, 2017, 3:42am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/3 "2017-09-06T03:42:32Z")

</div>

tnx for your reply, I guess I’m too tired for today lol, already did like 20 lvl in forest, there was also mistakes with {}  
**so what’s the different between “!” and “!=”**  **operators?**

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [September 6, 2017, 11:54pm UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/4 "2017-09-06T23:54:14Z")

</div>

`!=` is the Python version (not sure if it appears in others?)

---

<div class="post-metadata">

**Author:** ![oGREzok](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ogrezok/32/6910_2.png) [@oGREzok](https://discourse.codecombat.com/u/oGREzok)\
**Post date:** [September 9, 2017, 2:55am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/5 "2017-09-09T02:55:32Z")

</div>

that it’s a bug, because in javascript we use !=

---

<div class="post-metadata">

**Author:** ![byobcello](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/byobcello/32/6684_2.png) [@byobcello](https://discourse.codecombat.com/u/byobcello)\
**Post date:** [September 9, 2017, 3:22am UTC](https://discourse.codecombat.com/t/solved-burlbole-grove-java/12364/6 "2017-09-09T03:22:27Z")

</div>

```javascript
// not equal: !=
// usage: compares the operands on both sides of the "!="
// and returns true if the operands are not equal to each other;
// else, it returns false
if ( 1 != 2 ) {
    hero.say("1 does not equal 2");
}

// not: !
// usage: if the following expression is true, the ! operator returns false;
// if the following expression is false, the ! operator returns true.
if ( !( 1 != 2 ) ) { // this is basically: if ( !(true) )
    hero.say("the hero won't say this");
}

```

Note that the `!=` operator compares two values on both sides.  
The `!` operator only uses a `true` or `false` value to the right side.

> **More on the not operator**
>
> ```javascript
> if ( !true ) { } // !true evaluates to false
> 
> if ( !false ) { } // !false evaluates to true
> 
> ```
