簡介
讓我們開始吧!
HTTP 伺服器
命令列應用程式
The shards command
使用編譯器
語法及語意
註解
常值 (Literals)
空值 (Nil)
布林值 (Bool)
整數 (Integers)
浮點數 (Floats)
字元 (Char)
字串 (String)
符號 (Symbol)
陣列 (Array)
雜湊 (Hash)
範圍 (Range)
正規表示式 (Regex)
序組 (Tuple)
命名序組 (NamedTuple)
程序 (Proc)
賦值
區域變數
Control expressions
Truthy and falsey values
if
As a suffix
As an expression
Ternary if
if var
if var.is_a?(...)
if var.responds_to?(...)
if var.nil?
if !
unless
case
while
break
next
until
&&
||
引入檔案
Types and methods
Everything is an object
The Program
Classes and methods
new, initialize and allocate
Methods and instance variables
型別推導
Union types
Overloading
Default values and named arguments
Splats and tuples
Type restrictions
Return types
Method arguments
Operators
Visibility
Inheritance
Virtual and abstract types
Class methods
Class variables
finalize
Modules
Generics
Structs
Constants
Enums
Blocks and Procs
Capturing blocks
Proc literal
Block forwarding
Closures
alias
Exception handling
型別語法
Type reflection
is_a?
nil?
responds_to?
as
as?
typeof
Macros
Macro methods
Hooks
Fresh variables
Annotations
Built-in annotations
Low-level primitives
pointerof
sizeof
instance_sizeof
offsetof
Uninitialized variable declaration
Compile-time flags
Cross-compilation
C bindings
lib
fun
out
to_unsafe
struct
union
enum
Variables
Constants
type
alias
Callbacks
Unsafe code
使用慣例
Coding style
撰寫文件
Database
Connection
Connection pool
Transactions
Guides
Performance
Concurrency
Testing
Writing Shards
Hosting on GitHub
Hosting on GitLab
Continuous Integration
Using Travis CI
Using CircleCI
Published with GitBook
As a suffix
作為後綴時
if
可以作為表達式的後綴:
a =
2
if
some_condition
# 上方等價於:
if
some_condition a =
2
end
這樣的寫法有時可增加程式碼的可讀性。
results matching "
"
No results matching "
"