From b7e1f4d9baaa0ec2e3d4ea289c27e7f433b9a0ad Mon Sep 17 00:00:00 2001 From: Jo Wroten Date: Tue, 6 Aug 2019 22:47:50 -0500 Subject: [PATCH] Moved from hello-ruby repo to here --- README.md | 9 +++++---- hello-world.rb | 13 +++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 hello-world.rb diff --git a/README.md b/README.md index 4fa2823..c04ae08 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# Hello (World) Learning +# Hello Ruby -A place for me to play around with some basic example apps, most commonly "Hello World"'s and "TODO" examples. - -**Each language/framework is broken down by branch.** +```bash +ruby helloworld-ruby.rb +``` +Prints: `Hello World` diff --git a/hello-world.rb b/hello-world.rb new file mode 100644 index 0000000..625ccd2 --- /dev/null +++ b/hello-world.rb @@ -0,0 +1,13 @@ +# https://stackoverflow.com/questions/705729/how-do-i-create-a-ruby-hello-world#705754 + +class HelloWorld + def initialize(name) + @name = name.capitalize + end + def sayHi + puts "Hello #{@name}!" + end +end + +hello = HelloWorld.new("World") +hello.sayHi