Jump to content

Displaying the version number with conditionals (if then) using Scheme

From LilyPond wiki
Revision as of 18:57, 16 November 2025 by Jean Abou Samra (talk | contribs) (Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series)

Thanks to its implementation of GUILE, LilyPond makes high level functionalities relatively easy to accomplish.

In this example, the title will mention the current version (i.e. the version the snippet was compiled with, regardless which version was originally used).

\version "2.24"

%% http://lsr.di.unimi.it/LSR/Item?id=264

\paper { tagline = ##f }

#(define pieceTagLine
  (if (not (defined? 'pieceTagLine))
      (string-append "You are running version " (lilypond-version))
      pieceTagLine))

\header{
  title = \pieceTagLine
}

{ c'4 }