/

Typing

Quarkdown is dynamically typed: every value that may be passed to a function argument is wrapped in a DynamicValue object. This object can represent any supported type, and it carries the information needed to convert itself to the expected type when required.

The dynamic value is then adapted or converted to the type expected by the signature of the native function (written in Kotlin, which is strongly typed) at invocation time. If a conversion cannot be made, an error occurs.

This invoke-time adaptation reduces constraints, allowing the same value to be handled differently depending on its context.

Example 1

.var {myvar} {true}

.if {.myvar}
    My value is .uppercase {.myvar}

My value is TRUE

In the previous example:

See the Value types section of this wiki to see all supported types.

Example: source + result

The following example is a simplified version of a function defined in this wiki, which shows a Quarkdown code snippet and its visual result right below it:

Example 2

.function {sourceresult}
    source:
    .code {markdown}
        .source
    .source

.sourceresult
    ##! Quarkdown 

    Quarkdown was born in **.sum {2000} {24}**
##! Quarkdown 

Quarkdown was born in **.sum {2000} {24}**

Quarkdown

Quarkdown was born in 2024

The previous example shows how versatile Quarkdown values are. In the function declaration, the .source argument is retrieved twice: