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

Getting real and imaginary parts

The two methods—re and im—return real and imaginary parts of the complex number, as follows:

my $z = 4+5i;

say $z.re;
# 4
say $z.im; # 5

The imaginary part is returned without the variable i.

The reals method returns a list containing both values, as shown here:

my $z = 4+5i;
say $z.reals; # (4 5)
主站蜘蛛池模板: 高密市| 贡山| 绥德县| 响水县| 集贤县| 武乡县| 台中县| 夏河县| 定兴县| 鸡东县| 贡觉县| 渑池县| 漳浦县| 中宁县| 嵩明县| 南安市| 托克逊县| 上饶县| 北宁市| 富源县| 昌黎县| 治县。| 连南| 沙洋县| 丘北县| 深水埗区| 遂宁市| 西贡区| 随州市| 玉树县| SHOW| 武汉市| 蕲春县| 滁州市| 武宣县| 湟源县| 镇坪县| 多伦县| 罗山县| 呼图壁县| 隆林|