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. 阿里云Oss对象存储

    将文件保存到阿里云上. 1.添加对象存储OSS空间 (新建Bucket) 可以在阿里云后台对象存储里面添加,也可以通过api添加.添加之后设置权限. skd使用. 1安装 Aliyun.OSS.SDK ...

  2. 【C语言】数组知识点总结

    [C语言]数组知识点总结 标签: 数组 2018年04月12日 17:44:4481人阅读 评论(0) 收藏 举报  分类: C语言知识总结(4)  版权声明:本文为博主原创文章,未经博主允许不得转载 ...

  3. Java 有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少?

    import java.util.Scanner; /** *有一对兔子,从出生后第3个月起每个月都生一对兔子, *小兔子长到第三个月后每个月又生一对兔子,假如兔子 *都不死,问每个月的兔子总数为多少 ...

  4. react-redux-数据流

    redux是严格的单向数据流 1,store.dispatch(action) 2, reducer(previousState, action), reducer是纯函数.它仅仅用于计算下一个 st ...

  5. Java作业:第一次过程性考核 ——长春职业技术学院 16级网络工程

    Java作业:第一次过程性考核 ••<结构化程序设计>•• 考核目标:初步了解Java基本语法规则,学习结构化程序设计思想. 码云链接:https://gitee.com/SoridoD/ ...

  6. iOS 判断一个类是否存在,NSStringFromClass 不用 import 就可以获取类

    Class myCls = NSClassFromString(@"Person"); NSString *str = NSStringFromClass(myCls); if ( ...

  7. mybatis 报The content of elements must consist of well-formed character data or markup. 语法格式错误

    最近在写sql的时候 同时使用到了 >= 和 <= 之前只使用一个的时候 没有什么问题,今天同时使用到了两个,结果xml出现了The content of elements must co ...

  8. LeetCode 56 合并区间

    题目: 给出一个区间的集合,请合并所有重叠的区间. 示例 1: 输入: [[1,3],[2,6],[8,10],[15,18]] 输出: [[1,6],[8,10],[15,18]] 解释: 区间 [ ...

  9. js 发送http请求

    // 1.创建 XHR对象(IE6- 为ActiveX对象) // 2.连接及发送请求 // 3.回调处理 function createXMLHttpRequest() {     var xhr; ...

  10. 用svm来做回归预测(python)

    ————————————————————***提醒自己结束了就发博客***————————————————————