Created
July 21, 2011 21:38
-
-
Save robertpateii/1098280 to your computer and use it in GitHub Desktop.
a buddy of mine, Scott, asked if tap could be done in PHP and Perl. Probably, but i wanted to write it in c#. reference - http://moonbase.rydia.net/mental/blog/programming/eavesdropping-on-expressions
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int k = 3; | |
int q = 5; | |
int t = 3; | |
float ans = 0; | |
ans = (k + 1) / (tap((q - t)) / 2); | |
Console.WriteLine(ans.ToString()); | |
Console.ReadKey(); | |
} | |
static dynamic tap (dynamic arg) | |
{ | |
object returnValue = arg; | |
Console.WriteLine("tap: " + returnValue.ToString()); | |
return returnValue; | |
} | |
} | |
} |
p.s.
dynamic is a .NET 4.0 thing. it's not available in previous versions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
result:
tap: 2
4