ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

30天代码day2 Operators

2019-03-01 08:51:04  阅读:268  来源: 互联网

标签:binary use used when Operators 30 day2 variable operator


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).

标签:binary,use,used,when,Operators,30,day2,variable,operator
来源: https://www.cnblogs.com/helloworld7/p/10454449.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有