Monday, 19 October 2015

rebus - Lock your computer when you walk away!


Well this is strange.


I forgot to lock my monitor when I walked away from my desk, at work, and one of my co-workers decided to have a little fun.


When I got back, I found this little C# console app code segment, sitting forefront on my machine. I ran it a few times, but the results don't really tell me anything.


Does anyone else know what this could mean??


void Main()
{
GetEwe();

Console.WriteLine($"You have been given: {Ewe}");
}

public enum Directions { Up, Down, Left, Right, Forward, Backward, Diagonally };
public Directions? Ewe;

public Directions GetEwe()
{
Random rand = new Random(DateTime.Now.Millisecond);
do

{
Ewe =
(
from direction in Enum.GetValues(typeof(Directions)).OfType()
//let u = Directions.Down
select direction
).ElementAt(rand.Next(0, Enum.GetNames(typeof(Directions)).Length));
}
while (Ewe == Directions.Up);
return Ewe.Value; Around();

}

private void Around()
{
Ewe = null;
}

Answer



I guess this is



A rickroll




Because



This code is never going to give you (Ewe) up, because the loop will assign a random direction to ewe as long as it is up
It is never going to let you (u) down, because the line//let u = Directions.Down is just a comment.
Since the return statement happens before calling Around(), it is obviously never going to run around.
And, because the method Around() is never called, it is also never going to "desert you", because it will never assign a null-value to Ewe.



No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...