18th Apr 2020, 5:51 PM
Robin Flickinger
Robin Flickinger - avatar
9 odpowiedzi
+ 1
else if(loottable > 25 && loottable <= 50) You miss loottable in the RHS.
18th Apr 2020, 5:54 PM
Avinesh
Avinesh - avatar
+ 1
Robin Flickinger , add in every conditional check the variable name again after logical and "&&" operator 🐱
18th Apr 2020, 5:56 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
I meant Right hand side. You must write the variable name on both sides of the && operator.
18th Apr 2020, 7:14 PM
Avinesh
Avinesh - avatar
+ 1
Robin Flickinger Also you have misspelled the variable name on line 11. Make that correction as well.
18th Apr 2020, 7:17 PM
Avinesh
Avinesh - avatar
+ 1
You can replace all "else if ... " expresion like first one, when you have sorted level ( in our case increase all the time the level. if(loottable <= 25){ alert("Bronze 1 dropped"); } else if(loottable <= 50) { alert("Bronze 2 dropped"); } else if(loottable <= 75) { alert("Bronze 3 dropped"); } else if(loottable <= 86.5) { alert("Silver 1 dropped"); } else if(loottable <= 98) { alert("Silver 2 dropped"); }
18th Apr 2020, 7:33 PM
VV.
+ 1
f(loottable <= 25){ alert("Bronze 1 dropped"); } else if(loottable > 25 && loottable<= 50) { alert("Bronze 2 dropped"); } else if(loottable > 50 && loottable<= 75) { alert("Bronze 3 dropped"); } else if(loottable > 75 && loottable<= 86.5) { alert("Silver 1 dropped"); } else if(loottable > 86.5 && loottable<= 98) { alert("Silver 2 dropped"); } else { alert("Titania Systems dropped!"); } U have to use Boolean expression after && ,|| ,! because these operators check for only Boolean operands .Here loottable<=50 returns true if condition is true else returns false
20th Apr 2020, 5:19 PM
Nikhil Maroju
Nikhil Maroju - avatar
0
Avinesh what is RHS? I am totally a newbie
18th Apr 2020, 7:12 PM
Robin Flickinger
Robin Flickinger - avatar
0
Avinesh ohhh ok i know what u mean, i had it like that before and it didn't work. I will try this again. Thank you!
18th Apr 2020, 7:14 PM
Robin Flickinger
Robin Flickinger - avatar
0
Cool it's workin! Thank you guys!
18th Apr 2020, 7:20 PM
Robin Flickinger
Robin Flickinger - avatar