Ruby → User Guide #08 - Ruby - control structures
case, for, Ruby, ruby lesson, ruby уроки, user guide, while, руководство пользователя
This chapter explores more of ruby's control structures.
case
We use the case statement to test a sequence of conditions. This is superficially similar to switch in C and Java but is considerably more powerful, as we shall see.
- ruby> …
Ruby → User 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.
- def fact(n)
- if n == 0
- 1
- else
- n * fact(n-1)
- end
- end
- print fact(ARGV[0].to_i), "\n"
Because this is …
Ruby → User 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.
- ruby> ary = [1, 2, "3"]
- [1, 2, "3"]
Arrays can be concatenated or repeated …
Ruby → User 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:
[] - …
Ruby → User 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 ('...').
- ruby> "abc"
- "abc"
- ruby> 'abc'
- "abc"
Double- and single-quoting have different effects in some cases. A double-quoted string allows character escapes by …
Ruby → User 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:
- n! = 1 (when n==0)
- = n * (n-1)! (otherwise)
In ruby, this can be written as:
- def fact(n)
- if n == 0
- 1
- else
- n …
Ruby → User 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 "
", so don't type the
- %
), type
- %
- % ruby -v
( -v tells the interpreter to print the version of ruby), …
Ruby → User 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 …
Ruby → Ruby on Rails - Generating resources
Ruby on Rails, Ruby, user, web, генерирование
Once managed to get in a previous article , a working version of the web application in Ruby, I went on to deal with the development and generation of resources, as well as with the study of architecture, Ruby on …
Ruby → Ruby on Rails - First start on the Windows
Rails, Ruby, Ruby on Rails, web, Wordpress
Working with Wordpress on hosting provider TimeWeb for almost a year, I start showing greater interest in web development. In particular it is also due to the fact that this is still sufficiently CMS voracious to resources, and also so …
- Last comments
- AKApril 1, 2025, 11:41 a.m.Добрый день. В данный момент работаю над проектом, где необходимо выводить звук из программы в определенное аудиоустройство (колонки, наушники, виртуальный кабель и т.д). Пишу на Qt5.12.12 поско…
- VPMarch 9, 2025, 4:14 p.m.Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…
- Now discuss on the forum
- DTApril 14, 2025, 3:38 p.m.Всем привет! На Qt 6.8 MinGW пытаюсь сделать управление подключением WiFi из программы. Пока делаю поддержку Windows, но так же хочу в дальнейшем внедрить и поддержку Linux/MacOS. Для…
- fFeb. 15, 2025, 1:46 p.m.Подскажите, пожалуйста! Как данный класс можно дополнить, чтобы созданные объекты можно было перемещать мышкой по сцене?
- Не запускается компьютер (точнее работает блок , но сам монитор вообще жесть)В общем я ничего с интернета не скачивала в последнее время. На компе никаких левых пр…
- Вопрос решен. Узнать QModelIndex элемента на который мы перетаскиваем другой элемент, можно с помощью функции indexAt(event->position().toPoint()) представления QTreeViev вызываемой в переопр…