---
title: VersionNumber
description: Reference for the VersionNumber type, a semantic or calendar version number.
---

# VersionNumber

A VersionNumber represents a semantic or calendar version number.

The following methods are available for a VersionNumber:

##### `getMajor() -> String`

Get the major version number, i.e. the first version component.

##### `getMinor() -> String`

Get the minor version number, i.e. the second version component.

##### `getPatch() -> String`

Get the patch version number, i.e. the third version component.

##### `matches( condition: String ) -> Boolean`

Check whether the version satisfies a version requirement.

The version requirement string can be prefixed with the usual comparison operators:

- `=` or `==`: equal to
- `<` (`<=`): less than (or equal to)
- `>` (`>=`): greater than (or equal to)
- `!=` or `<>`: not equal

For example:

```nextflow
if( !nextflow.version.matches('>=23.10') ) {
    error "This workflow requires Nextflow version 23.10 or greater -- You are running version $nextflow.version"
}
```

Multiple constraints can be specified as a comma-separated list, e.g. `>=23.10, <=24.10`.

Alternatively, the version can be suffixed with `+`, which is similar to `==` but also allows the last version part to be greater. For example, `23.10.1+` is satisfied by `23.10.1` and `23.10.2`, but not `23.11.x` or `23.09.x`. Additionally, `23.10.+` is equivalent to `23.10.0+`. This operator is a useful way to enforce a specific version while allowing for newer patch releases.
