0

what is the use of this keyword in java

16th Dec 2016, 2:36 PM
Aruna Srivastava
2 Answers
+ 2
The if and if else statements are like "verification" statements. It can be used like such, function main { var x = prompt("Write a number") ; // Gives a value for x if (x < 3) { alert("That number is less than 3!") ; } else { alert("That number is greater or equal to 3!") ; } } This function can be taken logically because if x were to be less than 3, an alert will pop up saying that x is less than 3. Else, that number will be >= 3.
16th Dec 2016, 4:45 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
this is another way to view it could be simpler to understand var myNum1 = 7; var myNum2 = 10; if (myNum1 > myNum2) { alert("The number is not greater than 10"); } else { alert("the number is greater than 10"); } ...
20th Dec 2016, 7:33 PM
Hayes njogu
Hayes njogu - avatar