I'm not sure what's the difference, why are they used. I use the print to make a message appear in the console but what's the point in using warn() and error()? If I do use error does it stop the script or will it just come up as red in the output?
✓ ANSWER ACCEPTED
What's the difference between print() warn() and error()?
1 answer
✓ Accepted answer
The reason there are 3 methods of logging to the output is so developers can filter the messages to find errors or self warnings in their scripts. For example if I had a script and there was a place in the script it should never get to, you can use a warning or an error to say it got to a place it shouldn't. The main use is to filter between messages for developers, print can also be used for reassuring the developer the script has got to a certain point. Error will stop the script like any other error, and will state the line the error outputs as well as the defined message. Read more about them here.
This discussion is preserved as it was. New answers, comments, and votes are closed.
