Demonstrates getting the last error message after a failed operation.
ID: 322
using uCalcSoftware;
var uc = new uCalc();
// Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error.
uc.EvalStr("5 * (10 +");
// Check the error message from the last operation.
Console.WriteLine($"Last error message: {uc.Error.Message}");
Last error message: Bracket delimiter error using uCalcSoftware; var uc = new uCalc(); // Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error. uc.EvalStr("5 * (10 +"); // Check the error message from the last operation. Console.WriteLine($"Last error message: {uc.Error.Message}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error.
uc.EvalStr("5 * (10 +");
// Check the error message from the last operation.
cout << "Last error message: " << uc.Error().Message() << endl;
}
Last error message: Bracket delimiter error #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error. uc.EvalStr("5 * (10 +"); // Check the error message from the last operation. cout << "Last error message: " << uc.Error().Message() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error.
uc.EvalStr("5 * (10 +")
'// Check the error message from the last operation.
Console.WriteLine($"Last error message: {uc.Error.Message}")
End Sub
End Module
Last error message: Bracket delimiter error Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// Attempt to evaluate an expression with unbalanced parenthesis causing a syntax error. uc.EvalStr("5 * (10 +") '// Check the error message from the last operation. Console.WriteLine($"Last error message: {uc.Error.Message}") End Sub End Module