A simple lookup to retrieve a defined variable by its name and display its value.

ID: 374

				
					using uCalcSoftware;

var uc = new uCalc();
uc.DefineVariable("MyVar = 123");

// Retrieve the item by name
var item = uc.ItemOf("MyVar");

// Check if the item was found and print its value
if (item.NotEmpty()) {
   Console.WriteLine($"Value of MyVar is: {item.Value()}");
}
				
			
Value of MyVar is: 123
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uc.DefineVariable("MyVar = 123");

   // Retrieve the item by name
   auto item = uc.ItemOf("MyVar");

   // Check if the item was found and print its value
   if (item.NotEmpty()) {
      cout << "Value of MyVar is: " << item.Value() << endl;
   }
}
				
			
Value of MyVar is: 123
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      uc.DefineVariable("MyVar = 123")
      
      '// Retrieve the item by name
      Dim item = uc.ItemOf("MyVar")
      
      '// Check if the item was found and print its value
      If item.NotEmpty() Then
         Console.WriteLine($"Value of MyVar is: {item.Value()}")
      End If
   End Sub
End Module
				
			
Value of MyVar is: 123