I have a trigger on/off. I want a large part of my code running only when trigger is on. Nevertheless using "if" function leaves me with no other option but to recall it for each expression I use.
This is a naive example to point out what i mean:
t = 0;
If[t == 1,
test1 = Log[23]
]
If[t == 1,
test2 = test1*3 + 45
]
setting t==1 (on, runs my code. test1 is initialized. Then I do the same thing with test2 (i mean, repeating the "if" check).
is there any way to run all my code within one "if"?