Difference between revisions of "Print text to the default display"

From CodeCodex

(Ruby)
Line 1: Line 1:
 
==Implementations==
 
==Implementations==
 
===C===
 
===C===
<highlightsyntax language="c">
+
<pre class="c">
 
#include <stdio.h>
 
#include <stdio.h>
 
printf("text to display\n");
 
printf("text to display\n");
</highlightsyntax>
+
</pre>
  
 
===C++===
 
===C++===
<highlightsyntax language="cpp">
+
<pre class="cpp">
 
#include <iostream>
 
#include <iostream>
 
std::cout << "text to display" << std::endl;
 
std::cout << "text to display" << std::endl;
</highlightsyntax>
+
</pre>
  
 
===Common Lisp===
 
===Common Lisp===
Line 18: Line 18:
  
 
===Haskell===
 
===Haskell===
<highlightsyntax language="haskell">
+
<pre class="haskell">
 
putStrLn "text to display"
 
putStrLn "text to display"
</highlightsyntax>
+
</pre>
  
 
===Java===
 
===Java===
<highlightsyntax language="java">
+
<pre class="java">
 
System.out.println("text to display");
 
System.out.println("text to display");
</highlightsyntax>
+
</pre>
  
 
===OCaml===
 
===OCaml===
<highlightsyntax language="ocaml">
+
<pre class="ocaml">
 
print_endline "text to display"
 
print_endline "text to display"
</highlightsyntax>
+
</pre>
  
 
===Perl===
 
===Perl===
<highlightsyntax language="perl">
+
<pre class="perl">
 
print "text to display\n";
 
print "text to display\n";
</highlightsyntax>
+
</pre>
  
 
===PHP===
 
===PHP===
<highlightsyntax language="php3"><?php
+
<pre class="php">
 +
<?php
 
echo "text to display\n";
 
echo "text to display\n";
 
?>
 
?>
</highlightsyntax>
+
</pre>
  
 
===Python===
 
===Python===
<highlightsyntax language="python">
+
<pre class="python">
 
print "text to display"
 
print "text to display"
</highlightsyntax>
+
</pre>
  
 
===Ruby===
 
===Ruby===
<pre>
+
<pre class="ruby">
 
print "text to display\n"
 
print "text to display\n"
 
</pre>
 
</pre>
Line 63: Line 64:
 
[[Category:Python]]
 
[[Category:Python]]
 
[[Category:Ruby]]
 
[[Category:Ruby]]
[[Category:UI]]
+
[[Category:I/O]]

Revision as of 07:07, 11 January 2011

Implementations

C

#include <stdio.h>
printf("text to display\n");

C++

#include <iostream>
std::cout << "text to display" << std::endl;

Common Lisp

(format t "text to display")

Haskell

putStrLn "text to display"

Java

System.out.println("text to display");

OCaml

print_endline "text to display"

Perl

print "text to display\n";

PHP

<?php
echo "text to display\n";
?>

Python

print "text to display"

Ruby

print "text to display\n"