Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu Show menu

Scripts - Statements and comments


A MedCalc script is a set of instructions - called statements - to be executed by the program.

  • A statement performs a single action.

  • Statements are composed of assignments, comments, variables, control structures, commands, expressions, and mathematical operations.

  • Statements end with a semicolon.

  • Commands, variable names and functions are case-insensitive. In the documentation, we sometimes use uppercase for clarity.

This is an example of an asignment statement:


In this example, a workspace variable with the name k is created and the value 0 is assigned to it.

A compound statement, or statement block, is a construct with several simple statements enclosed with braces (curly brackets):



The script can contain comments; this is text that will completely be ignored by the program.

A comment starts with // (two slashes). Any text between the comment marker // and the end of the line are ignored when you run the script.

k=5; // create variable k and assign the value 5 to it

In a string constant, two slashes can be used without indicating a comment.


See also