- Rexx 教程
- Rexx - 首頁
- Rexx - 概述
- Rexx - 環境
- Rexx - 安裝
- Rexx - 外掛安裝
- Rexx - 基本語法
- Rexx - 資料型別
- Rexx - 變數
- Rexx - 運算子
- Rexx - 陣列
- Rexx - 迴圈
- Rexx - 決策
- Rexx - 數字
- Rexx - 字串
- Rexx - 函式
- Rexx - 棧
- Rexx - 檔案 I/O
- Rexx - 檔案函式
- Rexx - 子程式
- Rexx - 內建函式
- Rexx - 系統命令
- Rexx - XML
- Rexx - Regina
- Rexx - 解析
- Rexx - 訊號
- Rexx - 除錯
- Rexx - 錯誤處理
- Rexx - 面向物件
- Rexx - 可移植性
- Rexx - 擴充套件函式
- Rexx - 指令
- Rexx - 實現
- Rexx - Netrexx
- Rexx - Brexx
- Rexx - 資料庫
- 手持式和嵌入式
- Rexx - 效能
- Rexx - 最佳程式設計實踐
- Rexx - 圖形使用者介面
- Rexx - Reginald
- Rexx - Web 程式設計
- Rexx 有用資源
- Rexx - 快速指南
- Rexx - 有用資源
- Rexx - 討論
Rexx - 位運算子
Groovy 提供了四個位運算子。以下是 Groovy 中可用的位運算子。
| 序號 | 運算子和描述 |
|---|---|
| 1 | bitand 這是按位“與”運算子 |
| 2 | bitor 這是按位“或”運算子 |
| 3 | bitxor 這是按位“異或”或“排他或”運算子 |
以下是展示這些運算子的真值表:
| p | q | p bitand q | p bitor q | p bitxor q |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 |
示例
以下程式展示瞭如何使用各種運算子。
/* Main program */ a = 21 b = 347 Say c2b(a) Say c2b(b) Say c2b(bitand(a,b)) Say c2b(bitor(a,b)) Say c2b(bitxor(a,b)) Exit c2b: return x2b(c2x(arg(1)))
以上程式的輸出將是:
0011001000110001 001100110011010000110111 001100100011000000110111 001100110011010100110111 000000010000010100110111
rexx_operators.htm
廣告