Operators
These allow you to perform certain operations on your data. There are 3 basic types:

  1. Unary: operates on 1 operand
  2. Binary: operates on 2 operands
  3. Ternary: operates on 3 operands

Arithmetic Operators
The binary operators used for arithmetic are as follows:

  • +: Additive
  • -: Subtraction
  • *: Multiplication
  • /: Division
  • %: Remainder (modulo)

Additional Operators

    • +: A binary operator used for String concatenation
    • ++: This unary operator is used to preincrement 前自增(increment by 1 before use) when prepended to a variable name or postincrement 后自增(increment by 1 after use) when appended to a variable.
    • --: This unary operator is used to predecrement 前自减(decrement by 1 before use) when prepended to a variable name or postdecrement 后自减(decrement by 1 after use) when appended to a variable.
    • !: This unary operator means not (negation). It's used before a variable or logical expression that evaluates to true or false.
    • ==: This binary operator is used to check the equality of 2 primitives.
    • !=: This binary operator is used to check the inequality of 2 primitives.
    • <, >, <=, >=: These are the respective binary operators for less than, greater than, less than or equal to, and greater than or equal to, and are used to compare two operands.
    • &&, ||: These are the respective binary operators used to perform logical AND and logical OR operations on two boolean (i.e.: true or false) statements.
    • ? : This ternary operator is used for simple conditional statements (i.e.: if ? then : else).

30天代码day2 Operators的更多相关文章

  1. 30行代码搞定WCF并发性能测试

    [以下只是个人观点,欢迎交流] 30行代码搞定WCF并发性能 轻量级测试. 1. 调用并发测试接口 static void Main()         {               List< ...

  2. 30行代码让你理解angular依赖注入:angular 依赖注入原理

    依赖注入(Dependency Injection,简称DI)是像C#,java等典型的面向对象语言框架设计原则控制反转的一种典型的一种实现方式,angular把它引入到js中,介绍angular依赖 ...

  3. 30行代码实现Javascript中的MVC

    从09年左右开始,MVC逐渐在前端领域大放异彩,并终于在刚刚过去的2015年随着React Native的推出而迎来大爆发:AngularJS.EmberJS.Backbone.ReactJS.Rio ...

  4. Tensorflow快餐教程(1) - 30行代码搞定手写识别

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/lusing/article/details ...

  5. 10分钟教你用python 30行代码搞定简单手写识别!

    欲直接下载代码文件,关注我们的公众号哦!查看历史消息即可! 手写笔记还是电子笔记好呢? 毕业季刚结束,眼瞅着2018级小萌新马上就要来了,老腊肉小编为了咱学弟学妹们的学习,绞尽脑汁准备编一套大学秘籍, ...

  6. JAVA_SE基础——30.构造代码块

    黑马程序员入学blog...构造代码块作用:给所有的对象进行统一的初始化. 问题:要求每个小孩出生都会哭,这份代码有两个构造函数,如果需要每个小孩出生都要哭的话,那么就需要在不同的构造函数中都调用cr ...

  7. 30天代码day3 Intro to Conditional Statements

    Boolean A logical statement that evaluates to true or false. In some languages, true is interchangea ...

  8. 30 行代码实现 JS 中的 MVC

    一连串的名字走马观花式的出现和更迭,它们中一些已经渐渐淡出了大家的视野,一些还在迅速茁壮成长,一些则已经在特定的生态环境中独当一面舍我其谁.但不论如何,MVC已经并将持续深刻地影响前端工程师们的思维方 ...

  9. 30行代码消费腾讯人工智能开放平台提供的自然语言处理API

    腾讯人工智能AI开放平台上提供了很多免费的人工智能API,开发人员只需要一个QQ号就可以登录进去使用. 腾讯人工智能AI开放平台的地址:https://ai.qq.com/ 里面的好东西很多,以自然语 ...

随机推荐

  1. ssh自动登入

    公司的服务器在国外,所以测试的查看日志的时候需要测试机,然后继续ssh 非常不方便,所以编写一个简单的ssh登入脚本 #!/usr/bin/expectset timeout 3spawn ssh n ...

  2. UVa 11389 - The Bus Driver Problem 难度:0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  3. 关于css3 渐变色

    渐变色在现在来说非常的常用:(注意渐变色只能给背景加 不能给边框加) 方法:-webkit-linear-gradient() 括号里面第一个值为渐变色的开始方向,第二个值为开始的颜色,中间用逗号隔开 ...

  4. linux创建虚拟环境

    linux提供的虚拟环境工具: virtualenv   pipenv 1.安装python的虚拟环境 pip3 install -i https://pypi.tuna.tsinghua.edu.c ...

  5. VMware虚拟机开机自启动

    VMware虚拟机开机自启动 linux 2018年05月09日 08时30分18秒 VMware的命令行语句可以切换到VMware安装目录,使用vmrun.exe --help(windows下)查 ...

  6. CodeForces - 1101B

    题目: B. Accordion time limit per test 3 seconds memory limit per test 256 megabytes input standard in ...

  7. Ubuntu下安装chrome浏览器

    1.在终端中,输入以下命令: sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.l ...

  8. SQL优化清单

    SQL优化清单 1.from 语句中包含多个表的情况下,把记录数少的表放在前面 2.where 语句中包含多个条件时,将刷选多的条件放前面 3.避免使用select * ,因为这样会去查询所有列的数据 ...

  9. WordCount程序与测试

    Github地址: https://github.com/hcy6668/wordCount PSP表格: PSP PSP阶段 预估耗时(分钟) 实际耗时(分钟) Planning 计划 60 40 ...

  10. JavaWeb开发流程