Use the 'properties' parameter to disambiguate between the infix (binary) and prefix (unary) versions of the minus '-' operator.

ID: 375

				
					using uCalcSoftware;

var uc = new uCalc();
// Get the infix (subtraction) operator and check its operand count
var infixOp = uc.ItemOf("-", ItemIs.Infix);
Console.Write("Infix '-' operator has "); Console.Write(infixOp.Count);
Console.WriteLine(" operand(s).");

// Get the prefix (negation) operator
var prefixOp = uc.ItemOf("-", ItemIs.Prefix);
Console.Write("Prefix '-' operator has "); Console.Write(prefixOp.Count);
Console.WriteLine(" operand(s).");
				
			
Infix '-' operator has 2 operand(s).
Prefix '-' operator has 1 operand(s).
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Get the infix (subtraction) operator and check its operand count
   auto infixOp = uc.ItemOf("-", ItemIs::Infix);
   cout << "Infix '-' operator has " << infixOp.Count();
   cout << " operand(s)." << endl;

   // Get the prefix (negation) operator
   auto prefixOp = uc.ItemOf("-", ItemIs::Prefix);
   cout << "Prefix '-' operator has " << prefixOp.Count();
   cout << " operand(s)." << endl;
}
				
			
Infix '-' operator has 2 operand(s).
Prefix '-' operator has 1 operand(s).
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Get the infix (subtraction) operator and check its operand count
      Dim infixOp = uc.ItemOf("-", uCalc.Properties(ItemIs.Infix))
      Console.Write("Infix '-' operator has ")
      Console.Write(infixOp.Count)
      Console.WriteLine(" operand(s).")
      
      '// Get the prefix (negation) operator
      Dim prefixOp = uc.ItemOf("-", uCalc.Properties(ItemIs.Prefix))
      Console.Write("Prefix '-' operator has ")
      Console.Write(prefixOp.Count)
      Console.WriteLine(" operand(s).")
   End Sub
End Module
				
			
Infix '-' operator has 2 operand(s).
Prefix '-' operator has 1 operand(s).