Skip to content

#ASSERT


Preprocessor conditional directive

Syntax

` #assert condition

`

Parameters

condition

A conditional expression that is assumed to be true

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.

Examples

start GeSHi

vb
Const MIN = 5, MAX = 10
#assert MAX > MIN '' cause a compile-time error if MAX <= MIN

end GeSHi

Differences from QB

  • New to FreeBASIC

See also

  • ASSERT
  • #if
  • #error

Back to DocToc

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft