The question Find i^n, given n does not clearly state whether the solution must be a compilable program or can be an expression, neither does it identify where the input shall come from.
This leads to answers like this, which are a mixture of both and neither short nor compilable.
For verbose languages like C#, are LinqPad C# expressions encouraged in code-golf? If so, how to get the needed input?
A solution like
"i,-1,-i,1".Split(',')[n%4]
is nice and short and can compete with several other answers. But n
would need to be replaced by the actual number, which increases the length. Is that allowed and by definition we count n
just as 1 character?
Edit
There are 38 LinqPad answers already, applying the rules more or less lax. From the top-voted ones:
- This one might be ok, because it does not need input, but prints output to the LinqPad STDOUT if you like
- That uses a string as input but does not count it as characters
- This follows my example above
- Another approach seems to be a function that uses LinqPad specific methods (
.Dump()
) - This takes advantage of missing
using
statements in LinqPad