Skip to content

Keyword: catch

Represents the safe block of code to execute after a try block fails. Used in chain with the try keyword.

glang
# try { ... } catch [name] { ... }

try {
    # ...
} catch error {
    bark("Some error occured: " + error);
}

catch takes a variable name as the error output, where the variable name is a string type with the encountered error inside.

glang
try {
    1 / 0;
} catch division_error {
    bark(division_error); # output: division by 0
}

George Language is licensed under the GPL v3 openly. Help improve this site.