codecamp

Elixir 操作符表

OPERATOR    ASSOCIATIVITY
@                Unary
.                Left to right
+ - ! ^ not ~~~        Unary
* /                Left to right
+ -                Left to right
++ -- .. <>        Right to left
in                Left to right
|> <<< >>> ~>> <<~ ~> <~ <~> <|>    Left to right
< > <= >=        Left to right
== != =~ === !==    Left to right
&& &&& and        Left to right
|| ||| or        Left to right
=                Right to left
=>                Right to left
|                Right to left
::                Right to left
when                Right to left
<-, \\                Left to right
&                Unary

这些操作符中的大部分会在我们的教程中学习到。在下一章,我们将讨论一些基本函数,数据类型转换和一点点控制流。


Elixir 列表还是元组?
Elixir 匹配操作符
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

Elixir 基本操作符

Elixir 二进制,字符串和字符列表

Elixir 类型规格与行为

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }