18.02.2014, 20:23
there are two "else"'s too much, the if-conditional accepts one "else" only. which values are assigned to the variable loves? if its ranging from 1 to 4, then you can use a switch/case, if its a wider range, then you need to add the exact condition. here's an example for the if / else if / else if / else:
you can do it like this, too:
Код:
if(loves == 1) { lovesname = "gyomrбba"; } else if (loves == 2) { lovesname = "mбjбba"; } //on both of those lines... else if (loves == 3) { lovesname ="tьdejйbe"; } //...the exact conditional check is required. else { lovesname ="beleibe"; } //here you can ommit the "if", since its the last.
Код:
if(loves == 1) { lovesname = "gyomrбba"; } else if (loves >1 & loves =<10) { lovesname = "mбjбba"; } // bigger than 1 and smaller/equal to 10 else if (loves >10 & loves <51) { lovesname ="tьdejйbe"; } // bigger than 10 upto (not including) 51. so from 11 to 50 else { lovesname ="beleibe"; } // not 1, not from 2 to 10, not 11 to 50, therefore any value. it could be negative, too!