Equivalent of c\c++ compiler directives in Julia


using compiler directives like

#if A
some instructions 
#elseif B
some instructions

In c\c++ language one can tell the compiler to ignore some parts of code under some conditions. I`m curious about to know if there is an equivalent of this future in Julia language.

@static if. In many cases (if the compiler has enough information), it will automatically do the if statement at compilation time (and this is helped by automatic function specialization and multiple dispatch). Otherwise, at the top level you can force it via @static if.

1 Like

Thank you.

You usually don’t need it at toplevel.

1 Like