FreeBASIC マニュアルのトップに戻る

FreeBASIC OpImp

目次演算子論理演算子Operator Imp (Implication)←オリジナル・サイト

演算子 Imp (論理包含) 左にメニュー・フレームが表示されていない場合は、ここをクリックして下さい


2つの数値の、ビット Imp (論理包含)を返します。

構文:
declare operator Imp ( byref lhs as T1, byref rhs as T2 ) as Ret

用法:
result = lhs Imp rhs

パラメタ:
lhs
The left-hand side expression.
T1
Any numeric or boolean type.
rhs
The right-hand side expression.
T2
Any numeric or boolean type.
Ret
A numeric or boolean type (varies with T1 and T2).

Return Value:
Returns the bitwise-implication of the two operands.

Description:
This operator returns the bitwise-implication of its operands, a logical operation that results in a value with bits set depending on the bits of the operands (for conversion of a boolean to an integer, false or true boolean value becomes 0 or -1 integer value).

The truth table below demonstrates all combinations of a boolean-implication operation:

Lhs Bit Rhs Bit Result
0 0 1
1 0 0
0 1 1
1 1 1

No short-circuiting is performed - both expressions are always evaluated.

The return type depends on the types of values passed. Byte, Ubyte and floating-point type values are first converted to Integer. If the left and right-hand side types differ only in signedness, then the return type is the same as the left-hand side type (T1), otherwise, the larger of the two types is returned. Only if the left and right-hand side types are both Boolean, the return type is also Boolean.

This operator can be overloaded for user-defined types.

Examples:
Dim As UByte a, b, c
a = &b00001111
b = &b01010101
c = a Imp b '' c = &b11110101
 


Dialect Differences:

Differences from QB:

See also:
論理演算子 に戻る
演算子 に戻る
←リンク元に戻る プログラム開発関連に戻る

ページ歴史:2016-03-13 06:51:20
日本語翻訳:WATANABE Makoto、原文著作者:LaananFisher

ホームページのトップに戻る

表示-非営利-継承