Skip to content

procedures Assert

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › Preprocessor › #assert

#assert

Preprocessor conditional directive

Syntax

#assert condition

Parameters

  • condition

Description

Asserts the truth of a conditional expression at compile time. If condition is false, compilation will stop with an error.

This statement differs from the Assert macro in that #assert is evaluated at compile-time and Assert is evaluated at run-time.

Remarks

Differences from QB

  • New to FreeBASIC

See also

Examples

Const MIN = 5, MAX = 10

#assert MAX > MIN '' cause a compile-time error if MAX <= MIN

Category: Preprocessor
Kind: keyword


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally