User Tools

Site Tools


gams:enter_a_macro_over_multiple_lines

How do I enter a macro over multiple lines?

Q: Is it possible to enter a macro over multiple lines?

Eg. something like:

$macro myMacro
if (a = 1) then
 do something;
else
 do something else;
endif;

23.1 and later allow macro continuation characters. This is described in the release notes of 23.1 and is featured in the testlib model macro02.

While you can do a lot with macros, the intent was to have a compact representation of (recursively defined) expressions. Your example uses it for multiple statements. Be aware of macro expansion and compile time statements.

gams/enter_a_macro_over_multiple_lines.txt · Last modified: 2009/12/14 09:07 by support