## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# In the If at the end.Why do we not add correctGuess= true.?

In the If statement in the end why do we not do it like this: if (correctGuess= true) { document.write("<h1> You Guessed the number right.</h1>"); document.write("It took you " + guessCount + " tries to guess the correct number " + randomNumber + "."); } else if (correctGuess= false){ document.write("<h1> Sorry. You did not guess the number.</h1>") } Check your code and check IF statment

```=   is for Asign value to
Example :
var a = 2;

== is for equal check :)

var a == 2      -> this return true or false
```

so you cant do this

``` if (correctGuess= true)
``` Here is another way of doing it:

EDIT: if you just need to check if a variable is true or truthy, then you don't really need to say == true, == false etc..

```if (correctGuess) { // same as saying "correctGuess == true"
// do something
} else if (!correctGuess) { // same as saying "correctGuess != true"
// do something
} else {
// do something
}
``` 