Skip to content

Instantly share code, notes, and snippets.

@Pharap
Last active September 10, 2021 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pharap/ee2bd909e5994df58c956862ed7a3095 to your computer and use it in GitHub Desktop.
Save Pharap/ee2bd909e5994df58c956862ed7a3095 to your computer and use it in GitHub Desktop.
Printing 10 numbers in 9 different languages
-- Ada
with Ada.Text_IO;
use Ada.Text_IO;
procedure Example is
begin
for i in 0..9 loop
Put("i = ");
Put_Line(i);
end loop;
end Example;
10 REM BASIC
20
30 FOR I = 0 TO 9
40 PRINT "I = "; I
50 END
// C++
#include <iostream>
int main(int argument_count, char * arguments[])
{
for(int i = 0; i < 10; ++i)
std::cout << "i = " << i << '\n';
}
// C#
using System;
class Example
{
public static void Main(string[] arguments)
{
for(int i = 0; i < 10; ++i)
Console.WriteLine("i = {0}", i);
}
}
// Java
class Example
{
public static void main(String[] arguments)
{
for(int i = 0; i < 10; ++i)
System.out.println("i = " + i);
}
}
-- Lua
for i = 0, 9 do
print("i = "..i)
end
{ Pascal }
program example;
var
i: integer;
begin
for i := 0 to 9 do
begin
writeln('i = ', a)
end;
end.
' QB64 (QBasic)
For i = 0 To 9
PRINT "i = "; i
Next
' Visual Basic
Module Example
Sub Main()
For i As Integer = 0 To 9
Console.WriteLine("i = {0}", i)
Next
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment