2012年7月21日土曜日

開発環境

『Learning Ruby』(Michael Fitzgerald 著、O'Reilly Media、2007年、ISBN978-0-596-52986-4)の Chapter 9(Classes)Review Questions 2を解いてみる。

その他参考書籍

1.

「@」

コード(TextWrangler)

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

class C
  def initialize
    @str = "Hello, Ruby!"
  end
  def p
    puts @str
  end
end

c = C.new
c.p

入出力結果(Terminal)

$ ./sample.rb
Hello, Ruby!
$

0 コメント:

コメントを投稿