Skip to content

Instantly share code, notes, and snippets.

@kameko
Last active September 11, 2018 18:06
Show Gist options
  • Save kameko/fe940bffe804d81a66ba7cadda9cd69b to your computer and use it in GitHub Desktop.
Save kameko/fe940bffe804d81a66ba7cadda9cd69b to your computer and use it in GitHub Desktop.
using System;
class MainClass
{
public static void Main (string[] args)
{
var p = new Program();
p.Run();
}
}
public class Program
{
// Who needs silly old methods when you have switch blocks?
public void Run()
{
dynamic arg1 = null;
dynamic arg2 = null;
dynamic arg3 = null;
dynamic arg4 = null;
dynamic arg5 = null;
dynamic arg6 = null;
dynamic arg7 = null;
dynamic arg8 = null;
dynamic arg9 = null;
const String ENTRY = "ENTRY";
const String PRINT = "PRINT";
const String ADD = "ADD";
const String END = "END";
String lastCall = ENTRY;
START:
switch (lastCall)
{
case ENTRY:
{
if (lastCall == ENTRY) { arg1 = 5; arg2 = 7; lastCall = PRINT; goto case ADD; }
if (lastCall == PRINT) { lastCall = END; goto case PRINT; }
if (lastCall == END) goto END;
break;
}
case PRINT:
{
Console.WriteLine(arg1);
goto case ENTRY;
}
case ADD:
{
arg1 = arg1 + arg2;
goto case ENTRY;
}
}
goto START;
END:
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment