Philographer

# .to_s => toString()
# .class
# .ancestors 상속 관계 표시

# 코딩스타일 class: Camel Case
# ex) class SampleClass
# end

# 코딩스타일 method: Snake Case
# ex) sample_method
# end

# 코딩스타일 variable: Snake Case
# ex) sample_variable = 'sample'

# 진리값을 반환하는 메소드의 명칭
# ex) def happy?
# true
# end

# 코드 블록 방침
# 1. 여러 줄에 걸쳐 기술하는 경우
# ex) 1.upto(2) do |n|
# puts n
# end
# 2. 한 줄로 기술하는 경우
# ex) 1.upto(2) {|n| puts n}

# 범위 ..포함
# 범위 .. 포함x

# 블록 객체
# greeter = Proc.new{ |name|
# puts "Hello, #{name}"
# }
# greeter.call 'Proc'
# greeter.call 'Ruby'

# 다중 대입
# a, b = 1, 2
# a, *b = [1,2,3] a에 1을넣고 남은값들이 오른쪽에 대입된다.

# 예외
# begin
# 1/0
# rescue ZeroDivisionError
# puts '어떤 문제가 발생했다'
# end

# 외부 파일 읽기
# require '/path/to/library.rb'

# 예약어
# BEGIN, class, ensure, nil, self, when, END, def, false, not, super, while,
# alias, defined?, for, or, then, yield, and, do, if , redo, true, __LINE__, begin, else, in, rescue, undef, __FILE__break,elsif, module, retry, unless, __ENCODING__
# case, end, next, return, until

# 유사변수
# self, true, false, nil, __FILE__, __LINE__, __ENCODING__



댓글 로드 중…

트랙백을 확인할 수 있습니다

URL을 배껴둬서 트랙백을 보낼 수 있습니다