跳到主要内容

XOR

Returns the logical -Exclusive Or value of all arguments. The function returns -true when the number of -true inputs is odd and -false when the number of -true inputs is even.

Syntax

expression.XOR(args);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
argsRequiredApiRange | ApiName | boolean | boolean[]The conditions to check.

Returns

boolean

Example

This example shows how to return the logical Exclusive Or value of all arguments. The function returns true when the number of true inputs is odd and false when the number of true inputs is even.

// How to return the logical Exclusive Or value of all arguments.

// Use a function to calculate Exclusive Or.

const worksheet = Api.GetActiveSheet();

let func = Api.GetWorksheetFunction();
let ans = func.TRUE(); //returns TRUE, doesnt require arguments

worksheet.GetRange("A1").SetValue(ans);