Evgenii Legotckoi
June 23, 2016, 12:01 p.m.

RubyUser Guide #07 - Ruby - Back to the simple examples

руководство пользователя, ruby lesson, Ruby, ruby уроки, user guide, regular expressions, string

Now let's take apart the code of some of our previous example programs.

The following appeared in the simple examples chapter.

  1. def fact(n)
  2. if n == 0
  3. 1
  4. else
  5. n * fact(n-1)
  6. end
  7. end
  8. print fact(ARGV[0].to_i), "\n"

Because this is …

Read
Evgenii Legotckoi
June 21, 2016, 11:54 a.m.

RubyUser Guide #06 - Ruby - arrays

arrays, Ruby, ruby lesson, ruby уроки, user guide, массивы, руководство пользователя

You can create an array by listing some items within square brackets ([]) and separating them with commas. Ruby's arrays can accomodate diverse object types.

  1. ruby> ary = [1, 2, "3"]
  2. [1, 2, "3"]

Arrays can be concatenated or repeated …

Read
Evgenii Legotckoi
June 21, 2016, 11:52 a.m.

RubyUser Guide #05 - Ruby - Regular expressions

user guide, регулярные выражения, ruby lesson, Ruby, ruby уроки, руководство пользователя, regular expressions

Let's put together a more interesting program. This time we test whether a string fits a description, encoded into a concise pattern .

There are some characters and character combinations that have special meaning in these patterns, including:

[] - …

Read
Evgenii Legotckoi
June 18, 2016, 11:49 a.m.

RubyUser Guide #04 - Ruby - Strings

Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя

Ruby deals with strings as well as numerical data. A string may be double-quoted ("...") or single-quoted ('...').

  1. ruby> "abc"
  2. "abc"
  3. ruby> 'abc'
  4. "abc"

Double- and single-quoting have different effects in some cases. A double-quoted string allows character escapes by …

Read
Evgenii Legotckoi
June 18, 2016, 11:36 a.m.

RubyUser Guide #03 - Ruby - Simple examples

Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя

Let's write a function to compute factorials. The mathematical definition of n factorial is:

  1. n! = 1 (when n==0)
  2. = n * (n-1)! (otherwise)

In ruby, this can be written as:

  1. def fact(n)
  2. if n == 0
  3. 1
  4. else
  5. n
Read
Evgenii Legotckoi
June 17, 2016, 10:50 p.m.

RubyUser Guide #02 - Ruby - Getting Started

Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя

First, you'll want to check whether ruby is installed. From the shell prompt (denoted here by "

  1. %
", so don't type the
  1. %
), type

  1. % ruby -v

( -v tells the interpreter to print the version of ruby), …

Read
Evgenii Legotckoi
June 17, 2016, 10:47 p.m.

RubyUser Guide #01 - What is Ruby?

Ruby, ruby lesson, ruby уроки, user guide, руководство пользователя

Ruby is "an interpreted scripting language for quick and easy object-oriented programming"; what does this mean?

interpreted scripting language:

  • ability to make operating system calls directly
  • powerful string operations and regular expressions
  • immediate feedback during development

quick and easy:

  • variable …
Read
  • Last comments
  • Evgenii Legotckoi
    April 16, 2025, 5:08 p.m.
    Благодарю за отзыв. И вам желаю всяческих успехов!
  • IscanderChe
    April 12, 2025, 5:12 p.m.
    Добрый день. Спасибо Вам за этот проект и отдельно за ответы на форуме, которые мне очень помогли в некоммерческих пет-проектах. Профессиональным программистом я так и не стал, но узнал мно…
  • AK
    April 1, 2025, 11:41 a.m.
    Добрый день. В данный момент работаю над проектом, где необходимо выводить звук из программы в определенное аудиоустройство (колонки, наушники, виртуальный кабель и т.д). Пишу на Qt5.12.12 поско…
  • Evgenii Legotckoi
    March 9, 2025, 9:02 p.m.
    К сожалению, я этого подсказать не могу, поскольку у меня нет необходимости в обходе блокировок и т.д. Поэтому я и не задавался решением этой проблемы. Ну выглядит так, что вам действитель…
  • VP
    March 9, 2025, 4:14 p.m.
    Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…