Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

What's the difference between print() warn() and error()?

Asked by 8 years ago

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?

1 answer

Log in to vote
2
Answered by 8 years ago

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.

Ad

Answer this question