%macro: Define a macro for future re-execution. It accepts ranges of history, filenames or string objects.
%macro is a great way of storing code snippets into a bundle that can be re-used for future use.
In : a = 10 In : b = 2 In : c = a * b In : print(c) 20 In : %macro abc 1-4 Macro `abc` created. To execute, type its name (without quotes). === Macro contents: === a = 10 b = 2 c = a * b print(c) In : abc 20
You can view a macro’s contents by explicitly printing it:
In : print(abc) a = 10 b = 2 c = a * b print(c)