• Summary of ruby iterator knowledge


    In short: iteration refers to doing the same thing repeatedly, so iterator is used to repeat the same things many times. Iterators are collection supported methods. Objects that store a set of data members are called collections. In ruby, arrays and hashes can be called collections. Iterators return all elements of the collection, one after […]

  • In depth analysis of ruby variables


    A variable is a storage location that holds any data that can be used by any program. Ruby supports five types of variables. General lowercase letters, the beginning of the underline: variable. $starts with: global variable. @Beginning: instance variable. @@Start: class variables are shared in the entire inheritance chain Start with a capital letter: constant. […]

  • Object oriented knowledge summary of ruby


    Ruby is a pure object-oriented language. Everything in ruby is in the form of objects. Every value in ruby is an object, even the most primitive things: strings, numbers, even true and false. A class itself is an object, an instance of a class. This chapter will show you all the main features related to […]

  • Print does not wrap, puts will wrap page 1 / 2


    1. Print does not automatically wrap lines, and puts will automatically wrap lines. If a line is not enough, you can add “\” to connect Ruby code puts 6/2 Operation result: Ruby code Three 2. = =, EQL? Equal? Difference ==Equal value equal value equal value equal type equal value equal memory address equal A=1 […]

  • Download and installation of ruby under windows and Linux


    Here you can download the latest Ruby Version for you. The current stable version is 1.8.6. Please read before downloadingRuby open source license 。 Ruby source code If you want to make it more compatible with your platform or need to set up your environment specifically, installing from source is the best solution. This is […]

  • A good collection of e-book download addresses about Ruby


    Ruby doesn’t have many books. I collected these books from the Internet. Download them and click the picture directly Programming ruby, Second Edition: an introduction to ruby, Second Edition, required reading for learning Ruby (UPDATED)Agile web development with rails: beta 2. Based on rails 1.2 (UPDATED)The ruby way is now the second version updated to […]

  • Getting started with Ruby – Ruby installation


    For Ruby installation, you can go to the official website of ruby to download the windows installation package of ruby 1.56. After installation, open the DOS window and input ruby-v display Ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] indicates that Ruby has been installed successfully. The version number is ruby 1.96.   After installation, ruby-186-20 appears […]

  • 20 minutes to teach you Ruby quick start picture and text tutorial page 1 / 4


    All of a sudden, ruby is also good. I’m going to learn itintroduceThis is a short introduction to ruby. It only takes 20 minutes to read it completely. Let’s assume that the reader has installed ruby. If you haven’t, please visit the official Ruby website to download and install it before reading this article. Interactive […]

  • Introduction to Ruby page 1 of 5


    1、 Methods Ruby’s method definition allows setting default values for parameters. However, parameters without default values (allow * and &) cannot appear after parameters with default values. That is to say, the following method definitions are not allowed. Parse error will appear during interpretation. Another difference from C is that method definitions cannot appear after […]

  • What is ruby and Ruby overview


    Ruby is a powerful object-oriented scripting language, which can make you easily and quickly carry out object-oriented programming. Sometimes it’s a bit of a fuss to develop some small projects with formal object-oriented languages such as Smalltalk, Eiffel or C + +, and Ruby just can meet these requirements of object-oriented programming, You can also […]

  • Ruby Document Center – learning begins


    First, you need to check whether ruby is installed. At the shell prompt (in this case, it means “%”, so don’t type%), type % ruby -v   (- V tells the interpreter to print out the Ruby Version), and then click enter. If ruby is installed, you will see the following information: % ruby -v ruby 1.6.6 (2001-12-26) [i586-linux]   If ruby is not […]

  • Simple Ruby example


    Let’s write a function to calculate factorial. The mathematical definition of factorial is as follows: N! = 1 (when n = = 0)=N * (n-1)! (other cases) In ruby, you can write as follows: Copy codeThe code is as follows: def fact(n)          if n == 0            1          else            n * fact(n-1)            end        end   You may find the recurrence of end. Because […]