Mathematica Asked on March 3, 2021
I have Echo’s buried in code all over my notebook, I’d like a flag to turn them all on or off globally.
Unprotect[Echo];Echo=Identity
would disable them, but then you can’t re-enable themQuietEcho
doesn’t work because I’d have to write it add it around every blob of codeEcho
has an autoload, so you need to make sure the symbol is autoloaded before you modify its values:
DisableEcho[] := (Unprotect[Echo]; Echo; Echo = #&; Protect[Echo];)
EnableEcho[] := (Unprotect[Echo]; Echo=.; Protect[Echo];)
Test:
DisableEcho[]
Echo[3]
EnableEcho[]
Echo[3, "EchoLabel"]
3
EchoLabel 3
3
Correct answer by Carl Woll on March 3, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP