\n\n","answerCount":4,"upvoteCount":0,"suggestedAnswer":[{"@type":"Answer","text":"First of all,\r\n\r\n while (a>1){\r\n ++a\r\n }\r\n\r\nyour initial value of a is 1 . As a result, will not go inside while (a>1 => 1>1) \r\n\r\nMoreover you cannot use 'else' if there is no the corresponding if.","upvoteCount":1},{"@type":"Answer","text":"There are a lot of errors on your code.\r\n\r\nFirst of all what do you want to do ?","upvoteCount":0},{"@type":"Answer","text":"execute else (a+b)","upvoteCount":0},{"@type":"Answer","text":"Prokopios Poulimenos when I put var a= 3 it continues with errors","upvoteCount":0}]} }
0

i dont know what im doing wrong

<html> <head></head> <body> <script> var a = 1; var b= 2; while (a>1){ ++a } else(a+b) break; if else (a+a+a) break; </script> </body> </html>

6th Mar 2019, 7:24 AM
Gregorio Faerman
Gregorio Faerman - avatar
4 Answers
+ 1
First of all, while (a>1){ ++a } your initial value of a is 1 . As a result, will not go inside while (a>1 => 1>1) Moreover you cannot use 'else' if there is no the corresponding if.
6th Mar 2019, 2:44 PM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
0
There are a lot of errors on your code. First of all what do you want to do ?
6th Mar 2019, 9:05 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
0
execute else (a+b)
6th Mar 2019, 12:51 PM
Gregorio Faerman
Gregorio Faerman - avatar
0
Prokopios Poulimenos when I put var a= 3 it continues with errors
6th Mar 2019, 5:28 PM
Gregorio Faerman
Gregorio Faerman - avatar