Help:Programming Example Prototypes: Difference between revisions

Added works with, lang tags
(Added works with, lang tags)
 
(11 intermediate revisions by 4 users not shown)
Line 6:
----
 
''When using a [[compiler]] and a [[library]], with illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Compiler:''' [[Your Compiler Here]] (Your version here)
[[Category:Your Compiler Here]]
 
'''Library:''' [[{{libheader|Your Library Here]]}}
[[Category:Your Library Here]]
 
Some code.
Line 26 ⟶ 24:
----
 
''When using a compiler and a library, but without illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Compiler:''' [[Your Compiler Here]] (Your version here)
[[Category:Your Compiler Here]]
 
'''Library:''' [[{{libheader|Your Library Here]]}}
[[Category:Your Library Here]]
 
Some code.
Line 42 ⟶ 38:
----
 
''When using an [[interpreter]] and a library, with illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Interpreter:''' [[Your Interpreter Here]] (Your version here)
[[Category:Your Interpreter Here]]
 
'''Library:''' [[{{libheader|Your Library Here]]}}
[[Category:Your Library Here]]
 
Some code.
Line 62 ⟶ 56:
----
 
''When using an interpreter and a library, but without illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Interpreter:''' [[Your Interpreter Here]] (Your version here)
[[Category:Your Interpreter Here]]
 
'''Library:''' [[{{libheader|Your Library Here]]}}
[[Category:Your Library Here]]
 
Some code.
Line 78 ⟶ 70:
----
 
''When using a compiler, with illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Compiler:''' [[Your Compiler Here]]
[[Category:Your Compiler Here]]
Line 95 ⟶ 86:
----
 
''When using a compiler, but without illustrative text:''
 
[[Category:=={{header|Your Language Here]]}}==
==[[Ada]]==
'''Compiler:''' [[Category:Your LanguageCompiler Here]] (Your version here)
[[Category:Your LanguageCompiler Here]]
'''Compiler:''' [[Gnat]] (GPL 2005)
[[Category:GNAT GPL 2005]]
 
Some code.
with Ada.Text_Io;
Notice how each line begins with at least one space.
with Ada.Integer_text_IO;
Multiple spaces are fine; Please use proper indentation in your code.
 
----
 
''When using an interpreter, with illustrative text:''
procedure Call_Back_Example is
-- Purpose: Apply a callback to an array
-- Output: Prints the squares of an integer array to the console
-- Define the callback procedure
procedure Display(Location : Positive; Value : Integer) is
begin
Ada.Text_Io.Put("array(");
Ada.Integer_Text_Io.Put(Item => Location, Width => 1);
Ada.Text_Io.Put(") = ");
Ada.Integer_Text_Io.Put(Item => Value, Width => 1);
Ada.Text_Io.New_Line;
end Display;
-- Define an access type matching the signature of the callback procedure
type Call_Back_Access is access procedure(L : Positive; V : Integer);
-- Define an unconstrained array type
type Value_Array is array(Positive range <>) of Integer;
-- Define the procedure performing the callback
procedure Map(Values : Value_Array; Worker : Call_Back_Access) is
begin
for I in Values'range loop
Worker(I, Values(I));
end loop;
end Map;
-- Define and initialize the actual array
Sample : Value_Array := (5,4,3,2,1);
begin
Map(Sample, Display'access);
end Call_Back_Example;
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Compiler:''' [[Your Interpreter Here]] (Your version here)
[[Category:Your Interpreter Here]]
Line 157 ⟶ 116:
''When using an interpreter, but without illustrative text:
 
==[[{{header|Your Language Here]]}}==
[[Category:Your Language Here]]
'''Interpreter:''' [[Your Interpreter Here]] (Your version here)
[[Category:Your Interpreter Here]]
Line 168 ⟶ 126:
----
 
''When you don't know the compiler or interpreter, but you're using a library, and you are using illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:{{libheader|Your LanguageLibrary Here]]}}
'''Library:''' [[Your Library Here]]
[[Category:Your Library Here]]
 
Some code.
Line 185 ⟶ 141:
----
 
''When you don't know the compiler or interpreter, but you're using a library, and you are not using illustrative text:''
 
==[[{{header|Your Language Here]]}}==
[[Category:{{libheader|Your LanguageLibrary Here]]}}
'''Library:''' [[Your Library Here]]
[[Category:Your Library Here]]
 
Some code.
Line 198 ⟶ 152:
----
 
''When you don't know the compiler or interpreter, and you are using illustrative text:''
 
==[[Your Language Here]]==
[[Category:Your Language Here]]
 
[[Category:=={{header|Your Language Here]]}}==
Some code.
Notice how each line begins with at least one space.
Line 213 ⟶ 165:
----
 
''When you don't know the compiler or interpreter, and you are not using illustrative text:''
 
==[[Your Language Here]]==
[[Category:Your Language Here]]
 
[[Category:=={{header|Your Language Here]]}}==
Some code.
Notice how each line begins with at least one space.
Multiple spaces are fine; Please use proper indentation in your code.
[[Category:=={{header|Your Language Here]]}}==
<lang c>int main(){
printf("this is highlighted code");
printf("there is no need for spaces at the start of lines");
return 0;
}</lang>
[[Category:=={{header|Your Language Here]]}}==
{{works with|library/compiler/interpreter|Version Number}}
<lang c>int main(){
printf("this is highlighted code");
printf("there is no need for spaces at the start of lines");
return 0;
</lang>
Anonymous user