 # Describe the Numbers explainer

The aim of this puzzle: Update the test (the part inside the parentheses) of the second if statement to check if `x` is greater than 10 or if `y` is greater than 10.
Walkthrough of the solution: There are several new concepts in this puzzle! There are 2 comparison operators that allow you to compare 2 values. Greater than (`>`) checks if the value on the left side is greater than the right, if it is then statement is true. Less than (`<`) checks if the value on the left is less than the value on the right, if it is then the statement is true.

There is also a new logical operator, OR (`||`). `||` is very similar to `&&` in that it allows you to do multiple tests in one if statement. However, rather than both (or all) tests needing to be true for the code to run, only one of the tests need to be true. Have a look at the example below:

``````if (time > 10 || tiredness === 'yes') {
print('You should go to bed');
}
``````

In this example there are two variables called `time` and `tiredness`. The if statement is testing if `time` is greater than 10 as well as testing if `tiredness` is equal to ‘yes’. Only one of these statements need to be true in order for the message to be printing out. This means if `time` is 11 and `tiredness` is ‘no’ the message `'You should go to bed'` would still be printed out.

For this puzzle you need to update the numbers in the second if statement so that the code runs if `x` is greater than 10 OR if `y` is greater than 10.

Example solution:
(Tap below to reveal)

``````print('x is ' + x);
print('y is ' + y);
if (x > 3 && y < 10) {
print('x is greater than 3, and y is less than 10')
}
if (x > 10 || y > 10) {
print('x or y, or both, are greater than 10')
}
``````

JavaScript Concepts: Logical Operators, Comparison Operators, If Statement, Calling Functions, Identifiers
Grasshopper Concepts: print()

Additional Code (hidden code that runs before the puzzle’s code):

``````var x = pickRandom(13);
var y = pickRandom(13);
``````
5 Likes

Hi, in above code where we are defining values of X & Y.

1 Like

Good catch! `x` and `y` are declared in some hidden code to allow you to focus on updating the if statements test.

Often in programming you don’t know the exact value a variable is holding, but need to use it in your code.

H 3 Likes

@Grasshopper_Heather
Bear with us (newbies) with all these silly question. It really is a bit confusing about the lack of variables, but I understand the concept. We just have to get accustomed to it. E

2 Likes

Great feedback!

We are working on a way to surface this ‘additional code’ in the app, without making it overwhelming. Bear with us was we figure this out H 2 Likes

Dear H @Grasshopper_Heather ,

i think there is a slight of confussion. In the program the example solution: > x is greater than 4, and y is less than 11. In the solution: > x is greater than 3, and y is less than 11.

if i change x>4 there is error massage: Part of the code that is needed to solve this puzzle has been removed or edited…

And in this discussion, the example solution …x>3… the result: x is greater than 4.

I think it should be x>4 but maybe i missed something. Thanks.

@Cesario_Tarigan great catch! That was a typo in the explainer (the print out should have said `3` rather than `4`). I’ve updated it now, thanks so much for flagging!

H if we don’t use the print ( ’ x is ’ + x) ;
how can use var x = pickRandom(~);
in the puzzle
thank

I cant solve the code pls help me out

Hey there, try posting a screenshot and I’ll take a look.

Ben

I did exaclty what they did in the picture plz help me

how is that right

Hey there, if you’re stuck, try reading the post at the top of this thread that walks through the puzzle, and shows the solution code. If you have any questions about it, feel free to let me know.

print

(

'x is ’

x

)

;

print

(

'y is ’

y

)

;

if

(

x

3

&&

y

<

11

)

{

print

(

‘x is greater than 3, and y is less than 11’

)

;

}

if

(

)

{

print

(

‘x or y, or both, are greater than 10’

)

;

}

print

(

'x is greater than 10’✎

)

;

play_arrow Run Code

refresh

if

print()

x

y

num

str

◂ &&

◂ +

◂ <

◂ >

◂ ||

close

Hey there, copying and pasting the text on the screen messes up the formatting of your code. I can’t read what you posted.

Try taking a screenshot.

If you’re on a mobile device, read this guide for Android, or this guide for iOS.

If you’re on a computer, read this guide for Windows or this guide for MacOS.

Good luck! Let me know if you have any trouble.

Ben