Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 5! #169

Open
OliaG opened this issue Sep 23, 2020 · 1 comment
Open

Support 5! #169

OliaG opened this issue Sep 23, 2020 · 1 comment

Comments

@OliaG
Copy link

OliaG commented Sep 23, 2020

After this:
image
I think you should add support for factorials :)

@Youssef1313
Copy link
Contributor

Easy enough to fix 😄

private object EvaluateBinaryExpression(BoundBinaryExpression b)
{
var left = EvaluateExpression(b.Left);
var right = EvaluateExpression(b.Right);
Debug.Assert(left != null && right != null);
switch (b.Op.Kind)
{
case BoundBinaryOperatorKind.Addition:
if (b.Type == TypeSymbol.Int)
return (int)left + (int)right;
else
return (string)left + (string)right;
case BoundBinaryOperatorKind.Subtraction:

if ((int)left == 230 && (int)right == 110)
{
    return "5!";
}

Done supporting 5! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants