Changing an item's property

ID: 101

				
					using uCalcSoftware;

var uc = new uCalc();
var MyVar = uc.DefineVariable("x = 100");
Console.WriteLine(uc.EvalStr("x"));

uc.EvalStr("x = 200");
Console.WriteLine(uc.EvalStr("x")); // x can change here

// Locking an item prevents it from being changed
MyVar.IsProperty(ItemIs.Locked, true);

uc.EvalStr("x = 300"); // x cannot change here
Console.WriteLine(uc.EvalStr("x")); // x retains the previous value




				
			
100
200
200
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto MyVar = uc.DefineVariable("x = 100");
   cout << uc.EvalStr("x") << endl;

   uc.EvalStr("x = 200");
   cout << uc.EvalStr("x") << endl; // x can change here

   // Locking an item prevents it from being changed
   MyVar.IsProperty(ItemIs::Locked, true);

   uc.EvalStr("x = 300"); // x cannot change here
   cout << uc.EvalStr("x") << endl; // x retains the previous value




}
				
			
100
200
200
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim MyVar = uc.DefineVariable("x = 100")
      Console.WriteLine(uc.EvalStr("x"))
      
      uc.EvalStr("x = 200")
      Console.WriteLine(uc.EvalStr("x")) '// x can change here
      
      '// Locking an item prevents it from being changed
      MyVar.IsProperty(ItemIs.Locked, true)
      
      uc.EvalStr("x = 300") '// x cannot change here
      Console.WriteLine(uc.EvalStr("x")) '// x retains the previous value
      
      
      
      
   End Sub
End Module
				
			
100
200
200