Creating a variable in the default instance and retrieving its value.
ID: 607
See: (Constructor), Introduction
using uCalcSoftware;
var uc = new uCalc();
using (var myVar = new uCalc.Item("Variable: x = 42")) {
Console.WriteLine($"Created variable '{myVar.Name}' with value: {myVar.Value()}");
}
Created variable 'x' with value: 42 using uCalcSoftware; var uc = new uCalc(); using (var myVar = new uCalc.Item("Variable: x = 42")) { Console.WriteLine($"Created variable '{myVar.Name}' with value: {myVar.Value()}"); }
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
{
uCalc::Item myVar("Variable: x = 42");
myVar.Owned(); // Causes myVar to be released when it goes out of scope
cout << "Created variable '" << myVar.Name() << "' with value: " << myVar.Value() << endl;
}
}
Created variable 'x' with value: 42 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; { uCalc::Item myVar("Variable: x = 42"); myVar.Owned(); // Causes myVar to be released when it goes out of scope cout << "Created variable '" << myVar.Name() << "' with value: " << myVar.Value() << endl; } }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Using myVar As New uCalc.Item("Variable: x = 42")
Console.WriteLine($"Created variable '{myVar.Name}' with value: {myVar.Value()}")
End Using
End Sub
End Module
Created variable 'x' with value: 42 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Using myVar As New uCalc.Item("Variable: x = 42") Console.WriteLine($"Created variable '{myVar.Name}' with value: {myVar.Value()}") End Using End Sub End Module