ee.Number.or
Returns 1 if and only if either input value is non-zero.
Usage | Returns |
---|
Number.or(right) | Number |
Argument | Type | Details |
---|
this: left | Number | The left-hand value. |
right | Number | The right-hand value. |
Examples
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
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
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-06 UTC.
[null,null,["Last updated 2023-12-06 UTC."],[[["`Number.or()` is a function that returns 1 if either the left or right input is non-zero, otherwise it returns 0."],["It takes two `Number` type arguments: `left` representing the left-hand value and `right` representing the right-hand value."],["This function can be effectively used to check for the presence of non-zero values within Earth Engine computations."]]],[]]