falcon picture
  

Examples

The Falcon Programming Language

Part of the documentation for the Falcon language
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Index


Hello World

putstr( "Hello world\LF\", output );

The semicolon above is optional.

Copy Input to Output

while ~eof( input )
    putchar( getchar[ input ], output )
end

The above code illustrates the use of different kinds of parentheses and brackets to help the reader see which parenthesis matches which. The square brackets could just as easily have been replaced with regular round parentheses, without changing the meaning of the code.

Clean Up File While Copying

-- strip non ASCII content and all control characters from the input,
-- except newline characters, while copying from input to output

var
    ch char
code
    while ~eof( input )
        ch = getchar[ input ], output )
        if ch < " " -- control characters
            if ch = '\LF\'
                putchar( ch, output )
            end
        else        -- not a control character
            if ch < '\DEL\' -- printable
                putchar( ch, output )
            end
        end
    end
end

The above code illustrates the use of comments, variables, and if statements as well as a variety of simple expressions.