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

  • Perl 6 Deep Dive
  • Andrew Shitov
  • 183字
  • 2021-07-03 00:05:55

Operator classification

First, let's remind ourselves of some of the basic terminology that we need when talking about operators. Consider a simple example:

my $a = 10;
my $b = 20;
my $c = 0;
$c = $a + $b;
say $c; # 30

Let's concentrate on the following line of code:

$c = $a + $b;

Here, we tell the compiler to perform two actions—first, calculate the sum of the $a and $b variables, and second, assign the result to the third variable, that is, $c. There are two operators in this example—+ and =. Operators are presented by their one-character names. In this case, the names are chosen to copy the corresponding operators in mathematics. Later, we will see examples of other operators, which are not just a character. They can be, for example, a sequence of two or three non-alphabetical symbols, such as >= or <= operators. Or, they can be a string identifier, for example—cmp or eq.

主站蜘蛛池模板: 东阳市| 桐柏县| 兖州市| 栖霞市| 崇文区| 南雄市| 基隆市| 石楼县| 怀化市| 贺州市| 石阡县| 德昌县| 库尔勒市| 磐安县| 阳西县| 邵武市| 安福县| 沁源县| 阿拉善右旗| 肥东县| 灵石县| 宿迁市| 英超| 宁明县| 巴东县| 象山县| 黄冈市| 治县。| 泰顺县| 康定县| 襄垣县| 韶山市| 西贡区| 虎林市| 沁阳市| 玛纳斯县| 营山县| 稷山县| 平远县| 宣化县| 湖口县|