1. RubyLanguage 개 ¶
2. Ruby ¶
- 경기
- tryRuby
- irb
- visual studio ironRuby
- netbeans ruby그
- eclipse ruby그
- aptana (경 )
- tryRuby
- Hello Ruby!
-
- 1- 2
- 1
-2
- 1- 2
-
- 객 ?!
- 객
- 1.0/0.0 -> infinity
- 123.method
- "".method
- 1.0/0.0 -> infinity
- nilClass
- nilClass nil, prototype . 고
- 객, 객 객!
- class
- nilClass nil, prototype . 고
- 객
- 기 .
-
- Ruby.new
- 객
- !( )
- 규
- 규
- initialize 객 기
- initialize. ( )
class Some
def initialize
# init variablesend
end
- initialize. ( )
- 기(@)
def initialize - !( )
- 객 경 !
- 기
class Some
def initialize
# init variablesend
end
def Some.function
# dynamic function declare
end - 기
@var # this is the way how declaring variable
enddef initialize
end# this is overriding
end-
- 경, 게 까?
Some2.function2 # undefined method - 경, 게 까?
- / 까?
- superclass
- superclass
def Some.function2
# new function
endSome.function2 # works!
- attr_reader/attr_writer
- 결과
- {} def/end
- () !
- 기
- while
- do/while
- for
- while
-
- 기기
{| parameters| do something with parameters..}
yield : get the block and run it
a = 1, 2, 3, 4, 5
a.each {|x| puts x+1} # bloack ?(maybe)
- 기기
- 기
- 기
- <- gets
- <- puts, print
- 기
- if/else
- rescue 기
- 기
UnitTest::
3. Ruby 기 ¶
- RRobots RubyLanguage Robocode
- 고 tcl CodeRace 경
- Pair Programming : Pair 게 .
- Pair Programming : Pair 게 .
- 교 CodeRace
- A B .
- 고 갈 .
- Step 1
- 교 고 B 게 .
- 교 A B 갈 .
- 교 A B 갈 .
- 교 고 B 게 .
- A B .
class Layton def initialize @location = 'A' end def crossRiver printLocation @location = 'B' print " -> " printLocation print "\n" end def printLocation print @location end end
5. 기 ¶
- "" irb . irb , dll 까 . Ctrl+C N 꺼. irb 게 . 1+2 3 과 값 기( 경 =>nil !). 기기 #define . 게 . , 간 감 까 . 공 겠. -
- .. 까 각..ㅠㅠ 기기 yield구게 yield 고 . co-routine 고 ~ 게 갔!! . -
- 거 공 까 공 까ㅠㅠ - 경
- .. 까 각..ㅠㅠ 기기 yield구게 yield 고 . co-routine 고 ~ 게 갔!! . -
- 게 if-else ㅠ . 근 if구 게 기구. 간 C, C++, Java, JavaScript, Python 걸 고 . 근 기 " " .. . ㅠ ... 그고 개구 군. aptana... 게 . 그고 irb 개경 군. Python Shell 개경 . 그고 고 " " ... 그 궁금. -
- 게 기 게. RubyLanguage if 구 그 . 경 . 개 a b 그 add(a, b) . 과 겠.
- 게 기 게. RubyLanguage if 구 그 . 경 . 개 a b 그 add(a, b) . 과 겠.
add(3,4) # => 7 (# RubyLanguage ) add 3,4 # => 7. 경 경. 그 add 3, 4, 7 값 고
add(3, add(4, 7))
게 겠? 과 .
add 3, add 4, 7
그 add 게 겨 개 ? 경 경 . - 경
- Ruby 게 . irb Ruby . c 고 구 기. lua 공 wow 겠. -
- 고 . 그 ( ) 거 . 간 irb editor 고 겠. -
- RubyLanguage 금 공 각 . EuclideanAlgorithm 구 그 . Netbeans 걸 ~ 간게 고 간게 . - 경
- RubyLanguage 금 공 각 . EuclideanAlgorithm 구 그 . Netbeans 걸 ~ 간게 고 간게 . - 경
- 그간 공 고. "구" 각 게 . 고 그 ....... 게 거감 . -
- 기
- RubyLanguage . 그 게 게 . . 공 T_T
- CodeRace 간 각 겠 각 . 그 게 겠 게 .
- 간 CodeRace 간 걸 RubyLanguage . 그 기 고 기 고 기 간 거 각 .
- 게 CodeRace 고 . - 경
- RubyLanguage . 그 게 게 . . 공 T_T
- 게 고 . 간 게 걸 -
- Ruby . , 궁금 . 궁금군. 그 ㅋㅋㅋ (1. 개 , 2. 3. ). 그고 { |x| ~~ } 기 꺼 각 ? 궁금. -