A
Angel Marques
Hi..I'm learning rub..I know a bit about Python but I'm interested in
use rails...I made a little program but this has a little bug too..for
simplify this I dont post the program but I post a example
if I declare
var='hi'
def greeting
puts var
end
greeting()
greting
Do I need declare this like class variable necessarily?..inside my def
ruby can't see outside?..
ok..I declare this like a class variable...Now..I need a counter like
this
i=0
loop {
i+=1
puts 'hi again'
if i>100000: break end
}
why in this block I can see the outside value for i and inside the def
block I can't??
I should not use "standart" variables like variable instead use
@@variabl??
Please explain me this...and sorry for my poor english..I'm italian
use rails...I made a little program but this has a little bug too..for
simplify this I dont post the program but I post a example
if I declare
var='hi'
def greeting
puts var
end
greeting()
greting
Do I need declare this like class variable necessarily?..inside my def
ruby can't see outside?..
ok..I declare this like a class variable...Now..I need a counter like
this
i=0
loop {
i+=1
puts 'hi again'
if i>100000: break end
}
why in this block I can see the outside value for i and inside the def
block I can't??
I should not use "standart" variables like variable instead use
@@variabl??
Please explain me this...and sorry for my poor english..I'm italian