Echo feature allows redirecting the output AND duplicates the write to the current device.
For example, in a terminal :
Do ##class(IORedirect.Redirect).ToString(1)
Write "this an echo test"
Do ##class(IORedirect.Redirect).RestoreIO()
Set outputString = ##class(IORedirect.Redirect).Get()
Write "Var outputString : ", outputString
Redirect the write to a string variable and also write the text in the terminal.
This feature is available with :
Do ##class(IORedirect.Redirect).ToString(1)
Do ##class(IORedirect.Redirect).ToStream(stream, 1)
Do ##class(IORedirect.Redirect).ToFileCharacter(filename, 1)
Do ##class(IORedirect.Redirect).ToGlobal($Name(^||IORedirect), 1)
Echo is enabled with the value 1 on the last argument.