Macros

Found an issue in the documentation ? Please report it here !

Moderator: Documentation Editors

Ann
New User
New User
Posts: 2
Joined: Mon Jan 16, 2023 4:02 pm

Macros

Post by Ann »

Reference Manual -> Advanced Keywords -> Macro : EndMacro

Somewhere on that page, there is

Example: Advanced multi-line macro
that shows Assert and two examples.

It may be a joke (on those who love to use assert) or a typo: A "Not" is missing, so the code only asserts errors :)

Thanks for your attention.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2050
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Macros

Post by Andre »

Sorry, I don't really understand (but I'm not English-native)...

This is the related example code from the help --> could you show us, how it should look like? Thanks!

Code: Select all

  Macro DoubleQuote
    "
  EndMacro

  Macro Assert(Expression)
    CompilerIf #PB_Compiler_Debugger  ; Only enable assert in debug mode
      If Expression
        Debug "Assert (Line " + #PB_Compiler_Line + "): " + DoubleQuote#Expression#DoubleQuote
      EndIf
    CompilerEndIf
  EndMacro

  Assert(10 <> 10) ; Will display nothing
  Assert(10 <> 15) ; Should display the assert
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply