#Macro...#Endmacro

FreeBASIC

#Macro...#Endmacro
 
Preprocessor directive to define a multiline macro

Syntax

#macro identifier( [ parameters ] )
body
#endmacro

#macro identifier( [ parameters, ] Variadic_Parameter... )
body
#endmacro

Description

#macro is the multi-line version of #define.

Example

'' macro as an expression value
#macro Print1( a, b )
  a + b
#endmacro

Print Print1( "Hello", "World" )

'' Output :
'' Hello World!


'' macro as multiple statements
#macro Print2( a, b )
    Print a;
    Print " ";
    Print b;
    Print "!"
#endmacro

Print2( "Hello", "World" )

'' Output :
'' Hello World!


Differences from QB

  • New to FreeBASIC

See also