Difference between SetConstant and Scope.Add
See original GitHub issueHello,
I tried the following code
Engine engine = new Engine();
//engine.Scope.Add("time", 17);
engine.SetConstant("time", 17);
var result = engine.Interpret("(time > 12 ? (time - 12) + \" pm\" : time + \" am\")");
If I use Scope
I get (unknown) am
as the result
If I use SetConstant
I get the correct result as 5 pm
What are the differences Between these 2 methods, when do we use one over the other?
I was wondering why SetConstant
worked while Scope
did not?
Issue Analytics
- State:
- Created 8 months ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
c# - Defining Constants by Scope
A common reasoning against globals, singletons, etc. is that the scope of everything should be limited as far as (reasonably) possible.
Read more >JavaScript const
Block Scope. Declaring a variable with const is similar to let when it comes to Block Scope. The x declared in the block,...
Read more >Built-In Operators
The atxd operators add another geometry to the current product. Suppose, for example, that you have a 2D base geometry with scope comp1,...
Read more >Class IloObjective
An objective consists of its sense (specifying whether it is a minimization or maximization) and an expression. The expression may be a constant,...
Read more >Model House Heating System - MATLAB & Simulink
The simulation validates the expected behavior. Remove Constant, Step, and Scope blocks you added for testing the Heater component.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes I just replied a fraction of a second ago. Apologies !
All good! Hope everything now works as it should!