Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance logical operator behavior documentation #15695

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/types/value-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Operators:
* ``==`` (equality)
* ``!=`` (inequality)

The operators ``||`` and ``&&`` apply the common short-circuiting rules. This means that in the expression ``f(x) || g(y)``, if ``f(x)`` evaluates to ``true``, ``g(y)`` will not be evaluated even if it may have side-effects.
The operators `||` (logical OR) and `&&` (logical AND) leverage powerful short-circuiting rules that can dramatically affect performance and outcomes. In the expression `f(x) || g(y)`, if `f(x)` evaluates to **true**, the evaluation of `g(y)` is completely bypassed—**even if `g(y)` has critical side-effects**. This behavior not only optimizes execution but also safeguards against unintended consequences from functions that might alter state or perform costly operations. Understanding this can be pivotal in writing efficient and reliable Solidity code.

.. index:: ! uint, ! int, ! integer
.. _integers:
Expand Down
Loading