Quote:
still that didnt explain why goto is bad to use ?

I did say why it is "bad" to use: it lacks logic, it is unorganised code, and it is harder to follow the script. Since goto's jump, in order to follow how the script's logic works, you also have to jump to different parts when reading it.

Using if, elseif, else is far better as it creates a logic framework.

if (condition) {
commands
}
elseif (other condition) {
other commands
}
else {
commands to do when all other conditions failed
}

You can read and follow the logic with these constructs, as if you're reading a book line per line. Commands are grouped between the braces after each condition, so you see perfectly what will happen given a certain condition.

With goto's you have to jump along with them to follow the logic. It's like reading some stuff on one page of a book, and then jumping back to another part etc. It's messy.

Quote:

and if it works, then how can it be bad?

Because something works, doesn't necessarily mean it's good.