= Print = Print the given expression or expressionlist. e.g. {{{ #!cobra print 'My name is Cobra.' }}} Lacking any 'to DEST' clause the expressions provided are printed to the standard output with a trailing line terminator (\n or \r\n depending on platform). This trailing line terminator may be suppressed with a terminating 'stop' token after the expression list. ( There is no ',' before this token) {{{ #!cobra print 'No newline' stop }}} Multiple comma separated expressions are printed each separated by a single space. {{{ #!cobra print 'No moa', 'No moa', 'in all aotearoa' # emits 'No moa No moa in all aotearoa\n' }}} If a 'to DEST' clause is given the expression list is printed to that destination which must be a !TextWriter or subclass. The final form of the print statement given below does not print anything but sets up a (!TextWriter or subclass) redirection destination for any print statements in the subsequent block. Any and all of string expression interpolation and String.format processing can be specified within the expressions of the expression list. == Grammar == {{{ #!cobra print print [to DEST,] [, expression ...] [ stop] print to DEST BLOCK }}} == Platform == .Net: the destination must be a System.IO.!TextWriter or subclass. == Examples == {{{ #!cobra print # emit a blank line print 'Hello World' }}} {{{ #!cobra print 'Prompt:' stop input = Console.readline print a,b,c stop print d # a b c d all end up on the same line }}} {{{ #!cobra print "one", '2', 'free' # emits 'one 2 free\n' i = 2 s = 'free' print 'one [i] [s]' # same output as above }}} {{{ #!cobra # print to std error print to Console.error, 'error: all froobits bedazzled' sw = StringWriter() print to sw print 'Redirected to the StringWriter' s = sw.toString assert s.contains('Redirected to the StringWriter') }}} == Notes == Non string expressions are converted to a string representation for printing (presumably using their toString methods). Collections are expanded so their contents are displayed using {{{CobraCore.PrintStringMaker.makeString}}} (++ This needs expansion/explanation ++ ) See discussion forum [http://cobra-language.com/forums/viewtopic.php?f=4&t=160 Print vs Console.Writeline]