By using error() function, you can
define generic error with a message.
julia> function process_info(a) if(a<0) error("Invalid Domain") elseif(a>100) error("Index out of bounds") else println("Processing data") end end process_info (generic function with 2 methods) julia> process_info(-1) ERROR: Invalid Domain in process_info at none:3 julia> process_info(1) Processing data julia> process_info(101) ERROR: Index out of bounds in process_info at none:5
No comments:
Post a Comment