Articles

Affichage des articles du septembre, 2018

Développer en Ruby

Installation $ sudo apt-get install ruby1.9.1 $ sudo gem install ruby-debug-ide ==== Installation de Gems ==== * http://rubygems.org/gems/ruby-debug-ide <code>$ sudo gem install {gem-name}</code> Variables Variables are the memory locations which holds any data to be used by any program. There are five types of variables supported by Ruby. You already have gone through a small description of these variables in previous chapter as well. These five types of variables are explained in this chapter. ==== Ruby Global Variables ==== Global variables begin with $. Uninitialized global variables have the value nil and produce warnings with the -w option. Assignment to global variables alters global status. It is not recommended to use global variables. They make programs cryptic. Here is an example showing usage of global variable. <code> #!/usr/bin/ruby $global_variable = 10 class Class1 def print_global puts "Global variable in Class1 is #$global_variable&