#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Inizializzazione+Condizionale # Check the page for copyright notice and explanations >> a=10 => 10 >> a= a || 20 => 10 >> b= b || 20 => 20 >> a ||= 20 => 10 >> b ||= 30 => 20 >> c ||= 40 => 40 >> [a,b,c] => [10, 20, 40] >> pippo NameError: undefined local variable or method `pippo' for main:Object >> if not defined? pippo >> pippo=30 >> end => 30 >> pippo => 30 begin pippo rescue pippo = 30 end