I've seen it a few times, but I am not sure what it does and what it is supposed to do, is it like 'print()'? If this Question is not valid, I am sorry.
COMMUNITY QUESTION
How is 'error()' used, and what is it used for?
1 answer
Yes, error() is similar to print(), but instead of displaying a message in Output , it throws an error with the string passed to it. You can call the method like so:
error("Hello, this is an error.")
Which can be useful for some reasons, like if the script gets to a point it shouldn't.
Use that line from a Command Line or from a script to see an output similar to this:
Command Line:
21:33:08.172 - error("This is an error message"):1: This is an error message
21:33:08.173 - Script 'error("This is an error message")', Line 1
21:33:08.174 - Stack End
Script:
// I called the error method like this:
error("HELLO")
21:36:02.645 - Workspace.Script:1: HELLO
21:36:02.646 - Script 'Workspace.Script', Line 1
21:36:02.648 - Stack End
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
What would happen if I used it in a 'if' statement?