Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 468 Bytes

def-a-func.md

File metadata and controls

28 lines (20 loc) · 468 Bytes

Def a func

def a simple func

函数以def开头,以end结尾,def后紧跟函数名称,中间为函数内容

def sayHello
	puts"helloworld meows"
end
sayHello #执行函数

def a simple func

def a func and feed a param

def sayHelo(name="meow")
	puts"helo #{name}"
end
# 未指定参数时使用默认值
sayHelo
sayHelo("meows")