# Beginner problem

Hello guys I will show you my small code and then ask my problem.

``````    Void start ()
{

int a1 = Random.Range(1, 60);

Debug.Log("a1 =" + a1);

int a2 = Random.Range(48, 100);

Debug.Log("a2 =" + a2);

If(a1 < 50) {

Debug.Log(a2<50);

}

}
``````

………>>>>>>>>>

This is my code this is working in console when I run it shows me the random value of a1 and a2 but I want that if a1 is less than 50 then the value of a2 should be less than 50. Instead of this it shows me true or false. But I need that the value of a2 should be less than 50… please tell me my mistake.

Good day.

First, I strongly recommend you to watch more tutorials aboutr basic scripting…

Sevond, An if sentence is typed “if” not “If” (not capital i)

Third, your last line, you are printing a comparation between a2 and 50

Now, If you want a2 to be less than 50, you should do something like this:

``````int a1 = Random.Range(1, 60);
int a2 = 0; // Declare the variable and assign 0 for now...
if (a1 < 50)
{
a2 = Random.Range (48,50)
}
else // So a1 is > 50
{
a2 = Random.Range (50,100)
}
``````

Bye!