Defines variables with explicit types, inferred types, and default types.

ID: 306

				
					using uCalcSoftware;

var uc = new uCalc();
// Explicit type definition
uc.DefineVariable("explicitInt As Int = 123");

// Type inferred from the initial string value
uc.DefineVariable("inferredStr = 'hello'");

// Type defaults to Double as no type or value is given
var defaultVar = uc.DefineVariable("defaultVar");

Console.WriteLine($"explicitInt type: {uc.ItemOf("explicitInt").DataType.Name}");
Console.WriteLine($"inferredStr type: {uc.ItemOf("inferredStr").DataType.Name}");
Console.WriteLine($"defaultVar type: {defaultVar.DataType.Name}");
				
			
explicitInt type: int
inferredStr type: string
defaultVar type: double
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Explicit type definition
   uc.DefineVariable("explicitInt As Int = 123");

   // Type inferred from the initial string value
   uc.DefineVariable("inferredStr = 'hello'");

   // Type defaults to Double as no type or value is given
   auto defaultVar = uc.DefineVariable("defaultVar");

   cout << "explicitInt type: " << uc.ItemOf("explicitInt").DataType().Name() << endl;
   cout << "inferredStr type: " << uc.ItemOf("inferredStr").DataType().Name() << endl;
   cout << "defaultVar type: " << defaultVar.DataType().Name() << endl;
}
				
			
explicitInt type: int
inferredStr type: string
defaultVar type: double
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Explicit type definition
      uc.DefineVariable("explicitInt As Int = 123")
      
      '// Type inferred from the initial string value
      uc.DefineVariable("inferredStr = 'hello'")
      
      '// Type defaults to Double as no type or value is given
      Dim defaultVar = uc.DefineVariable("defaultVar")
      
      Console.WriteLine($"explicitInt type: {uc.ItemOf("explicitInt").DataType.Name}")
      Console.WriteLine($"inferredStr type: {uc.ItemOf("inferredStr").DataType.Name}")
      Console.WriteLine($"defaultVar type: {defaultVar.DataType.Name}")
   End Sub
End Module
				
			
explicitInt type: int
inferredStr type: string
defaultVar type: double