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

  • 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
主站蜘蛛池模板: 中江县| 潞城市| 乌海市| 阿勒泰市| 上饶县| 武乡县| 保德县| 乌拉特后旗| 泸西县| 太仆寺旗| 永兴县| 定结县| 乌鲁木齐县| 陇西县| 蒙山县| 鹤庆县| 汉寿县| 亳州市| 汉寿县| 临江市| 武安市| 工布江达县| 巍山| 瑞金市| 长治市| 甘肃省| 盐亭县| 喀喇沁旗| 梨树县| 香格里拉县| 郸城县| 台安县| 镇坪县| 天台县| 尼勒克县| 边坝县| 苏尼特左旗| 蒲江县| 阜平县| 开平市| 陵川县|