using uCalcSoftware;

var uc = new uCalc();
uc.Format("Result = 'Answer: ' + Result");
uc.Format("DataType: String, Def: val = '<<' + val + '>>' ");
uc.Format("DataType: Bool, Def: val = '[[' + val + ']]'");

// Note the difference between where "Bool: " and "String: " are displayed in the result
uc.Format("InsertAt: 0, DataType: Bool, Def: val = 'Bool: ' + val");  // Inserts at 0th position of Bool
uc.Format("InsertAt: 1, DataType: String, Def: val = 'String: ' + val"); // Inserts at 1st position of String
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
Console.WriteLine("---");

// This fomratting will be the last one to take effect
uc.Format("InsertAt: 0, Def: val = 'Outer: ' + val");
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
Console.WriteLine("---");

// This formatting will be the first one to take effect
uc.Format("val = 'Inner: ' + val"); // Optionally InsertAt: -1 could have been used
Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));
Console.WriteLine("---");

uc.FormatRemove();

Console.WriteLine(uc.EvalStr("10+20"));
Console.WriteLine(uc.EvalStr("'Hello '+'world'"));
Console.WriteLine(uc.EvalStr("5 > 10"));