The ruby language contains a type called the range class, which is a set of a range of some classes. Generally ".. "or "... "To define the range ,".. "indicates the value that contains the defined range ,"... "does not include the value at the end
After reading Ruby for a few days, I found many well-known syntax features in C #. Ruby was available a few years ago:
1. The Params keyword in C #
Class program {static void main (string [] ARGs) {console. writeline (sum (); console. writeline (
An important feature of closures is that variables defined inside a process (method) can be referenced even after the method call is complete! (That is, the lifecycle is extended)
Def method (n) puts "n = # {n}"; # Return proc {| I | n + = I} # key:
Rubyencoder protects Ruby and Ruby on Rails files through compilation and encryption. The encrypted script is run by the rubyencoder loader. Rubyencoder is composedInovica LtdDeveloped. They also made a similar thing for PHP:Sourceguardian.
1. Open and read files
File = file. Open ("cnblogslink.txt") file. Each {| Line | print "# {file. lineno}.", line} file. Close
Output:
1.Community 2. News
3. Community
4. News
5. Recruitment
6. Bo Wen
7. Group8. Flash9. Network
From a stranger to a preliminary understanding; from reading to hands-on practice, I want to say, you are very beautiful!
Ruby is a pure object-oriented scripting language developed by yukihiro Matsumoto in Japan. This language is designed to
ArticleDirectory
Variables
Conditions
Loops
Error Handling
Methods
Classes
Using code from other files
In the previous blogs, I introduced some ironruby-related content, because ironruby is in ruby. net, so its
Rails3 is coming out, and it's time to start learning. You can find a good tutorial on the Internet: http://railscasts.com/episodes, which can be downloaded.
Unfortunately, only 10 entries are displayed on each page and cannot be downloaded in
Get the currently running method name in Ruby on bigbold
Code Fragment:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Module KernelPrivate
Def
This_method_nameCaller [0]
= ~
/
'
In common: it is used for screen output.
Differences:After puts outputs the content, it will automatically wrap the text (if the content parameter is blank, only one line feed is output). If the content parameter contains an escape character, the
Some important differences between Ruby and C # are as follows:
1. Ruby is a dynamic language, and C # Is a static language-that is, after an object is new, Ruby can dynamically add some attributes or methods to the object instance (as does
Complained todayThe blog has not been updated for many days, which affects reading mood. I just need to start it. ^_^
# Part One
Afile = file. New ("C: \ 1.txt"," W ")
Afile. Puts "The 1"
Afile. Puts "The 2"
Afile. Close
# Part Two
What is jruby?
Jruby is a Ruby interpreter implemented in pure Java. Through jruby, you can directly run Ruby on JVMProgramTo call the Java class library. Many Ruby ides written in Java use jruby to explain the syntax.
Jruby, an open-source Ruby
Objects and attributesThe song object we created has an internal State (such as song title and artist ). This state is private to other objects-other objects cannot access the instance variables of an object. Generally, this is a good thing. This
Dynamic scripts in recent yearsProgramming LanguageIn China, Python and Ruby are becoming more and more popular, and they are often compared. I think they have their own characteristics:
51cto editing recommendations: Ruby tutorials and tips
1.
Matz is a professional software engineer working in netlab. JP, a famous open source company in Japan, and he is also a high-profile open source evangelist in Japan. He participated in several open-source software projects, including cmail. This is
Class String def has_one_in? (String_Arr) has = false string_Arr.each {| word | has = self. include? (Word) if has break end} has endenddef decode_subject (sub) if sub. include? ("B? ") Encode_str = sub. match (/= \? (.*?) \? =/). To_s
The Ruby pp () function can be used to output arrays in a very beautiful way. However, the disadvantage is that the two-dimensional array is displayed on one row. We want it to be output in the form of a subarray per row, as shown in
Is it more
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.