Last active
April 9, 2017 17:37
-
-
Save mwja/eb70aa7c1c7e1b7e0fe42ef62f93f9bc to your computer and use it in GitHub Desktop.
An example program in Otter, ruby extension for highlighting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body :: [String, String] := [ | |
"name" := "example", | |
"entry" := "Program.ot", | |
"includes" :: [String] := [ | |
"Program.ot" | |
] | |
"out" := "program.exe" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Program :: class | |
Program.create :: Number := (args :: [Number := String]) | |
j :: Number := 0 | j < args.len | j := j + 1 @ | |
console.writeln: "\(j) : \(args[j])" | |
console.writeln: "press any key to exit..." | |
console.readkey | |
# with the arguments `a b c foo bar` and the filename `code.ot` it outputs | |
# 0 code.ot | |
# 1 a | |
# 2 b | |
# 3 c | |
# 4 foo | |
# 5 bar | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
/// <summary> | |
/// The entry function. | |
/// </summary> | |
public static void Main(string[] args) | |
{ | |
int j = 0; | |
while (j<args.Length) | |
{ | |
System.Console.WriteLine(j.ToString() + " : " + args[j]); | |
j = j + 1; | |
} | |
System.Console.WriteLine("press any key to exit..."); | |
System.Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment