Usage edit

This template is used to display a code that is at least syntactically valid.

Examples edit

The following call

 {{Code:Valid| The code
   <syntaxhighlight lang="perl">
     my @array = qw(one two three);

     print "Array contains " . @array . " element" . (@array == 1) ? "" : "s" . \n";
   </syntaxhighlight>|
   returns the following:|
    String found where operator expected at qwError.pl line 3, at end of line
       (Missing semicolon on previous line?)
    Can't find string terminator '"' anywhere before EOF at qwError.pl line 3.
 }}

displays a perl code that is valid:

The code
my @array = qw(one two three);

print "Array contains " . @array . " element" . (@array == 1) ? "" : "s" . \n";
returns the following:
String found where operator expected at qwError.pl line 3, at end of line
       (Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at qwError.pl line 3.

See also edit