Logical "NON" operator (!)

Source: Internet
Author: User
Tags expression numeric numeric value string
An expression performs a logical negation.

result = !expression

Parameters

Result

Any variable .

Expression

Any expression .

Description

The following table illustrates how result is determined.

If expression is then result is
True False
False True

All unary operators, such as the ! operator, evaluate the value of an expression according to the following rules:

    • If applied to an undefined or null expression, a run-time error is generated.
    • object is converted to a string.
    • If possible, the string is converted to a numeric value. Otherwise, a run-time error is generated.
    • The Boolean value is treated as a numeric value (0 if False, or 1 if true).

The operator is used to produce a numeric value.

For the ! operator, if the expression is Non-zero, result is zero. If expression is zero, then result is 1.

Requirements

Version 1

Please see

~ operator | Operator Precedence | Operator Summary



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.