惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
O
OpenAI News
P
Palo Alto Networks Blog
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
TaoSecurity Blog
TaoSecurity Blog
量子位
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
S
Security @ Cisco Blogs
S
Schneier on Security
B
Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
AWS News Blog
AWS News Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
H
Heimdal Security Blog
I
Intezer
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
W
WeLiveSecurity

博客园 - Wisdom-zh

【关注】“诋毁” 一下博客园的模板 混淆器【修正版】 发一个混淆器, Nuva 写的 Win32Ole 演示【控制 Word】 Win32Api 演示【控制任务栏】 通用数据浏览示例 方便的 XML 数据绑定 Swap 函数 延迟计算 短路运算 这是什么语言的代码 Nuva 语法兼容 之 控制结构总结 设计模式 之 状态机模式 Nuva 示例代码(每日一帖)之 源代码统计 Nuva 示例代码(每日一帖)之 数据架构提取 Nuva 示例代码(每日一帖)之 ShowMessage Nuva 示例代码(每日一帖)之 异常处理 Nuva 示例代码(每日一帖)之 语法兼容 挑战 XSLT 最擅长的 XML 文档转换
语法兼容 之 运算符总结
Wisdom-zh · 2006-09-20 · via 博客园 - Wisdom-zh
<..========================================================
==                                                       ==
==                Macrobject Nuva Samples                ==
==                                                       ==
==      Copyright (c) 2004-2006 Macrobject Software      ==
==                                                       ==
==                  ALL RIGHTS RESERVED                  ==
==                                                       ==
==               http://www.macrobject.com               ==
==                                                       ==
========================================================..>
<.
// 单目双目运算符测试
? 2 + 3; ?? ' = 5';
? 2 - 3; ?? ' = -1';
? 2 * 3; ?? ' = 6';
? 2 / 3; ?? ' = 0.6...';
? 2 /% 3; ?? ' = 0'; // div
? 2 % 3; ?? ' = 2';  // mod
? 2 ^ 3; ?? ' = 8';
? 2 ** 3; ?? ' = 8';
? 2 ~ 3; ?? ' = 23'; // concat
? 2 << 3; ?? ' = 16';
? 2 >> 3; ?? ' = 0';
? 2 &^ 3; ?? ' = 2'; // bit and
? 2 |^ 3; ?? ' = 3'; // bit or
? 2 ^^ 3; ?? ' = 1'; // bit xor
? 2 = 3; ?? ' = false';
? 2 <> 3; ?? ' = true';
? 2 < 3; ?? ' = true';
? 2 > 3; ?? ' = false';
? 2 <= 3; ?? ' = true';
? 2 >= 3; ?? ' = false';
? 2 != 3; ?? ' = true';
? 2 == 3; ?? ' = false';
? 2 & 3; ?? ' = true';
? 2 && 3; ?? ' = true';
? 2 | 3; ?? ' = true';
? 2 || 3; ?? ' = true';
? 2 div 3; ?? ' = 0';
? 2 mod 3; ?? ' = 2';
? 2 and 3; ?? ' = true';
? 2 or 3; ?? ' = true';
? ! 3; ?? ' = false';
? !^ 3; ?? ' = -4';  // bit not
? not 3; ?? ' = false';

// 赋值运算符测试
var a = 1
? a ~ \t ~ '[1]' ~ \r\n

a := 2
? a ~ \t ~ '[2]' ~ \r\n

a += 2
? a ~ \t ~ '[4]' ~ \r\n

a -= 2
? a ~ \t ~ '[2]' ~ \r\n

a *= 2
? a ~ \t ~ '[4]' ~ \r\n

a /= 2
? a ~ \t ~ '[2]' ~ \r\n

a %= 2
? a ~ \t ~ '[0]' ~ \r\n

a ^= 2
? a ~ \t ~ '[0]' ~ \r\n

a ~= 2
? a ~ \t ~ '[02]' ~ \r\n

a &= 2
? a ~ \t ~ '[true]' ~ \r\n

a |= 2
? a ~ \t ~ '[true]' ~ \r\n
.>

<..
【简介】
    本例是一个 Nuva 语言的语法兼容性示例,目的为了演示 Nuva 语言对于其他编程语言的部分语法兼容性。

    Nuva 语言作为一种新生的编程语言,并不强迫程序员的编程风格。因此,Nuva 语言兼容多种编程语言的语法风格,本例演示的是 Nuva 语言的部分运算符的语法兼容性(不完全总结)。

【看点】
    1、本例演示了 Nuva 语言的部分运算符的语法兼容性,如 +, -, and, or 等。

【扩展】
    本例是一个语法兼容示例,无扩展需求,以后将逐步编写更多的语法兼容示例。
..>

本例运行结果如下:

5 = 5
-1 = -1
6 = 6
0.666666666666667 = 0.6...
0 = 0
2 = 2
8 = 8
8 = 8
23 = 23
16 = 16
0 = 0
2 = 2
3 = 3
1 = 1
False = false
True = true
True = true
False = false
True = true
False = false
True = true
False = false
True = true
True = true
True = true
True = true
0 = 0
2 = 2
True = true
True = true
False = false
-4 = -4
False = false
1 [1]
2 [2]
4 [4]
2 [2]
4 [4]
2 [2]
0 [0]
0 [0]
02 [02]
True [true]
True [true]