Skip to content

Instantly share code, notes, and snippets.

@johobemax
Created July 16, 2010 09:57
Show Gist options
  • Save johobemax/478195 to your computer and use it in GitHub Desktop.
Save johobemax/478195 to your computer and use it in GitHub Desktop.
class MusicPlayer
attr_accessor :music, :volume
def play()
puts "#{@music}を再生します"
end
def stop()
puts "#{@music}を停止します"
end
def volumeChange(v)
@volume = v
puts "音量を#{volume}に変更しました"
end
end
ply = MusicPlayer.new
ply.music = "ドラえもんの歌"
ply.play
ply.stop
ply.volumeChange 20
@johobemax
Copy link
Author

MusicPlayerのRuby版。

http://gist.github.com/478002
どっちがわかりやすい?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment