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

Hello, I encountered a situation and I would like to know if there is a way to achieve it. Please take a look at my code #320

Open
jiangzhuangxiansheng opened this issue Sep 28, 2024 · 4 comments
Labels

Comments

@jiangzhuangxiansheng
Copy link

Hello, I encountered a situation and I would like to know if there is a way to achieve it. Please take a look at my code:

var target = new Interpreter()
.SetVariable("a", 10)
.SetVariable("b", 5);
var expression = "a + b";

I would like to obtain the expression "10 + 5"

@davideicardi
Copy link
Member

Sorry @jiangzhuangxiansheng , but I'm not sure to understand what is your problem.
I think you can write something like:

var result = target.Eval("a + b");

@jiangzhuangxiansheng
Copy link
Author

var expression = target.xxx("a + b")
return expression
The result is "10 + 5" instead of 15

@davideicardi
Copy link
Member

davideicardi commented Oct 9, 2024

Can you show me the full code? I suppose the problem is that the variables that you are using are of type string , not numbers (int, ...).

@metoule
Copy link
Contributor

metoule commented Nov 16, 2024

I think it's a duplicate of #254

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

No branches or pull requests

3 participants