julia> a = 3
3
julia> b = 4
4
julia> throw("a:$a is unequal b:$b")
ERROR: "a:3 is unequal b:4"
Stacktrace:
[1] top-level scope
@ REPL[19]:1
I am a bit confused here. Is the ‘ERROR’ here indicating that there is some syntax error in my codes, or is it a normal output of throw?
This is normal and expected - when you use the throw
function, you are explicitly raising an exception with a custom error message. For ex - if you asked user to enter a number and they entered a word (string) instead - you can use ‘throw’ function in your code to politely inform them of the error.
2 Likes