fn: ||
[contents]

Contents

Syntax

The syntax for || calls is:

f++:  
||(params)

n++:  
@||(params)

Description

|| is the logical or operator, it takes a non-zero number of parameters, if any of the parameters evaluate to true then it returns 1, otherwise it returns 0.

Note: It is typically faster to use exprtk for logical operators, plus the syntax is nicer.

f++ example

Example of || being used with f++:

int x=3, y=7
if(||(<(y, 1), <(x, y))
	console("y is less than 1 or greater than x")

n++ example

Examples of || being used with n++:

@int x=3, y=7
@if(||(<(y, 1), <(x, y))
	@console("y is less than 1 or greater than x")

@int x=3, y=7
@console(@||(<(y, 1), <(x, y)))

int a=3, b=-2

@console("@||(@>(a, 0), @>(b, 0))")
@# expected output: 1

@console("@!(@||(@>(a, 0), @>(b, 0)))")
@# expected output: 0

Sponsors