 # Describe the Numbers explainer

#1

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);
``````

#2

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

#3

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 #4

@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

#5

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 #6

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.

#7

@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 #8

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