wish of those help I note that you've changed the code originally posted, deleting the duplicate line numbers That will make the first part of this answer look weird, but I'll leave it. The compiler is telling you that you're re-using the same line numbers. Notice the following section of code?
26 PRINT "DRIVE A: WILL BE LOST!"
27 INPUT "Proceed with Format (Y/N)"; F$
26 IF F$ = "Y" THEN GOTO 28
27 IF F$ = "N" THEN GOTO 16
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14 ELSE GOTO 13
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14
16 IF I$ <> "C:\WINDOWS\COMMAND.COM" THEN GOTO 13
Compilation error executing basic if else statements
should help you out I had a similar code to this using numbers, and it worked perfectly. This however keeps underlining the word else and I don't know why. I am just playing around with java trying to understand a few principles. , Never use == to compare strings. use .equals instead.
this will help #2 occures because c<8 is evaluated to a boolean which can't be added to an int. There is no compilation error in the line before because the boolean expression is converted to a String before being concatenated. Be aware that the order matters! While s = k + c + (c < 8) + "" is not a valid expression, s = "" + k + c + (c < 8) is one. #3 occures because the expression c + 1 evaluates to an int whose storage size is greater than that of a char, so it has to be cast like so: (char) (c + 1). #4 occures because you can't assign a String expression to a boolean variable Take a look at the specification of the + operator to understand what actually happens and to the narrowing primitive conversion section to see why the cast is needed.