SORU
7 HAZİRAN 2010, PAZARTESİ


Çoklu Satır Yorumları Ruby?

Nasıl Ruby birden fazla satır yorum alabilir miyim?

CEVAP
7 HAZİRAN 2010, PAZARTESİ


#!/usr/bin/env ruby

=begin
Every body mentioned this way
to have multiline comments.

It has to be at the beginning of a line or
it will be a syntax error.
=end

puts "Hello world!"

<<-DOC
Also, you could create a docstring.
which...
DOC

puts "Hello world!"

"..is kinda ugly and creates
a String instance, but I know one guy
with a Smalltalk background, who
does this."

puts "Hello world!"

##
# most
# people
# do
# this


__END__

But all forgot there is another option.
Only at the end of a file, of course.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • buttheadgsxr1000

    buttheadgsxr

    24 Ocak 2008
  • Excel Functions

    Excel Functi

    4 NİSAN 2010
  • Project Mooncircle

    Project Moon

    6 Aralık 2009