Skip to content

print

Syntax

print(expr_or_string, ..., expr_or_string)

Parameters

expr_or_string
A valid expression or a literal string surrounded by quotation marks.

Description

Invokation of this action prints text to a file called print_output.txt in FRED's user output folder.

One or more arguments can be passed to the action. If the argument is a string value surrounded with quotes (e.g. "hello world"), it will be printed literally. If there are no quotes (e.g. my_variable), the argument will be evaluated instead.

Examples

The following prints: Hello world!

simulation {
    start_date = 2020-Jan-01
    end_date = 2020-Jan-01
    locations = none
    default_model = none
}

condition HELLO_WORLD {
    start_state = Excluded
    meta_start_state = MetaStart

    state MetaStart {
        print("Hello, World!")
        wait()
        next()
    }
}

The following prints: 1 + 1 is 2

simulation {
    start_date = 2020-Jan-01
    end_date = 2020-Jan-01
    locations = none
    default_model = none
}

variables {
    shared numeric x
    x = 1
}

condition SUM_CALCULATOR {
    start_state = Excluded
    meta_start_state = MetaStart

    state MetaStart {
        print("1 + ", x, " is ", x + 1)

        wait()
        next()
    }
}

See Also