Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

code-blocks - Golf documentation (program-flow)

Description

CODEBLOCKS Use curly braces ("{" and "}") to open and close a code block. They create a separate scope for previously non-existing variables defined within them, which begins with "{" and ends with "}". Note that if a variable existed in an outer scope, it cannot be created in the inner scope. Note that if-true, run-query, start-loop and read-line statements contain implicit code blocks, meaning the code between them and the accompanying end-statement is within implicit "{" and "}".

Examples

The following code will first print out "outside" and then "inside" twice, illustrating the fact that variable "s1" is defined only in the outer scope once. Variable "s2" exists only in inner scope: begin-handler /scope public @<<print-out s1>> set-string s1="outside" { set-string s2="inner variable" set-string s1="inside" @<<print-out s1>> } @<<print-out s1>> end-handler

Name

code-blocks - Golf documentation (program-flow)

See Also

Program flow break-loopcall-handlercode-blockscontinue-loopdo-onceexit-handlerif-definedif-truequit-processreturn-handlerstart-loop See all documentation $DATE $VERSION GOLF(2gg)

See Also