ee.Number.or

Returns 1 if and only if either input value is non-zero.

UsageReturns
Number.or(right)Number
ArgumentTypeDetails
this: leftNumberThe left-hand value.
rightNumberThe right-hand value.

Examples

Code Editor (JavaScript)

print('Either 0 or 5 non-zero?', ee.Number(0).or(ee.Number(5)));  // 1
print('Either 0 or 0 non-zero?', ee.Number(0).or(ee.Number(0)));  // 0

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

print('Either 0 or 5 non-zero?', ee.Number(0).Or(ee.Number(5)).getInfo())  # 1
print('Either 0 or 0 non-zero?', ee.Number(0).Or(ee.Number(0)).getInfo())  # 0