Re: Newbie ahead!: Ruby-Demo


#1

Meino Christian C. [mailto:removed_email_address@domain.invalid] :

can someone point me to a ruby demo-script?

I want to show a friend the beauty of ruby and am myself fear if

would try my best would acchieve the opposite of what I want.

It dont need to do anything sophisticated it only should show the

Pros of programming in ruby…

Show “Hello, world.” in 3 ways.

Way 1. print hello world on screen.
code: puts “Hello, world.”
audience comment: hmmmm… ok…

Way 2. print helloworld 100 times
codeA. puts “Hello, world.\n” * 100
or
codeB. 100.times{ puts “Hello, world.”}
audience comment: coool…l :slight_smile:

Way 3. print helloworld to pdf.
code: require “pdf/writer”
pdf = PDF::Writer.new
pdf.select_font “Times-Roman”
100.times {pdf.text “Hello, world.”}
pdf.save_as(“hello.pdf”)
audience comment: …cannot comment… audience rotfl…