Python and Ruby are currently very popular.Programming Language. They are ideal for building software prototypes. These two languages are also suitable for developing web applications.Program. The latest Ruby version is 1.9.2, and the latest Python
1. Japanese to UTF-8Differences between iconv. New ('cp932', 'utf-8') and iconv. New ('shift _ JIS ', 'utf-8')
Iconv. New ('shift _ JIS ', 'utf-8') does not support the following formats:
When bytes 001-18 xxxxxxx, you can only replace the bytes
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
The behavior of an object depends on its class, but we often know that a specific object requires a specific behavior. in many languages, we have to get into the trouble of defining another class, even if it is only used for the next ing. in Ruby,
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:
When using Ruby to output text to the console, Good coloring is necessary. The following describes how to output the colored text to the OS X terminal. In fact, it should also apply in Linux.
Originally, I only needed to post the link to the blog
I have written a simple unit test library for myself in Ruby over the past few days. It feels a little DSL.
It seems that there is no ruby format. Use Lua to make it together.
Sample Code:
Code highlighting produced by Actipro CodeHighlighter
Ruby identifiers are used to point to constants, variables, methods, classes, and modules. The first letter of the identifiers helps us determine the scope of the content that the identifiers direct.
Ruby is case sensitive.
Ruby uses a convention
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.
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
Recently I started to learn ruby. to practice the basic syntax, I used ruby to write an insert sorting algorithm, which may be a trace of translation from C #.
1. Insert sorting
Seq = [3, 4, 9, 0, 2, 5, 9, 7, 1]1. upto (seq. length-1) do | I |If
Ruby Stone scissors cloth game
Copy codeThe Code is as follows:# Encoding: UTF-8Arr = ['stone ', 'scissors', 'bo']Win_arr = [['stone ', 'scissors'], ['scissors ', 'cloth'], ['cloth ', 'stone']# Add the random computer value to the result
The Ruby language has many special functions that deserve further research. For example, the syntax is different from that of other programming languages. Here we will understand some concepts related to Ruby's special syntax.
Basic Syntax of
Classes and objects in Ruby are important knowledge points. To learn the Ruby language, you must first master the application of Ruby objects and classes. Here we will learn about the Ruby core class.
Ruby blocks provides flexible encoding methods
To install Ruby, go to the Ruby official website to download the Windows Installation Package of Ruby1.56. After installing ruby, open the Dos window and enter Ruby-v to display it.Ruby 1.8.6 (patchlevel 0) [i386-mswin32] indicates that Ruby has
In daily life, we classify all objects at a certain level. we know that all cats are mammals, and all mammals are animals. small classes from largerClass. If all the mammals want to breathe, then the CAT also needs to breathe.In Ruby, we can express
# Scanweb. rb# Use ruby scanweb. rb www.jb51.net to save the current result in c: \ 1.txtRequire 'net/http'Filename = File. new ('C: \ 1.txt ', "w + ")If $ * [0] = nilPuts "hehe, no URL entered"ElseH = Net: HTTP. new ($ * [0], 80)Resp, data = h. get
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service