Dylan (programming Language) - Syntax

Syntax

Initially, Dylan used a Scheme-like prefix syntax, which is based on s-expressions:

(bind ((radius 5) (circumference (* 2 $pi radius))) (if (> circumference 42) (format-out "Hello big circle! c is %=" circumference) (format-out "Hello circle! c is %=" circumference)))

By the time the language design was completed, it was changed to an Algol-like syntax, designed by Michael Kahl, with the expectation that it would be more familiar to a wider audience of programmers:

let radius = 5; let circumference = 2 * $pi * radius; if (circumference > 42) format-out("Hello, big circle! c is %=", circumference); else format-out("Hello, circle! c is %=", circumference); end if

Similar to other functional programming languages, the result of a function is the value of the last expression evaluated—there is no explicit “return” statement. The following function returns the value of the “if” statement (statements, too, produce results), which evaluates to the value of either “1” or “n * factorial(n - 1)”:

define method factorial(n :: ) if (n = 0) 1 else n * factorial(n - 1) end end method;

Read more about this topic:  Dylan (programming Language)