官术网_书友最值得收藏!

  • Mastering Chef
  • Mayank Joshi
  • 127字
  • 2021-07-16 14:02:25

Basic operations

Like all other programming languages, Ruby comes packed with a whole bunch of operators.

Arithmetic operators

Assume a = 2 and b = 4.

Comparison operators

Assignment operators

Bitwise operators

Logical operators

Ruby range operators

The Ruby defined? operator

The defined? operator is an operator that checks whether the passed expression is defined or not. If the expression is not defined, it returns nil or else a description of the expression as a string:

  • The defined? variable: If the variable is defined, it returns true
  • The defined? method: If the method is defined, it returns true
  • The defined? super: If the method exists that can be called with superuser, it returns true
  • The defined? yield: If the code block has been passed, it returns true
主站蜘蛛池模板: 确山县| 彭泽县| 本溪| 远安县| 突泉县| 新和县| 高台县| 宜城市| 博湖县| 涡阳县| 阳城县| 都昌县| 黔江区| 郯城县| 通州区| 德兴市| 通州区| 平潭县| 华坪县| 平凉市| 当涂县| 建水县| 财经| 遂川县| 息烽县| 贡山| 平泉县| 台北市| 临城县| 巴彦县| 井冈山市| 沙雅县| 苍溪县| 永丰县| 凌海市| 福州市| 延庆县| 永寿县| 玛沁县| 镇平县| 永泰县|