Z
Zehao
One interesting thing is when running the following codes
File.open("testfile") |aFile| do
print a while a=aFile.gets
end
one will get an error indicating a doesn't exist. This error can be
fixed by adding a line a="" before the print command.
But logically speaking, "print a" should be interpreted after
"a=File.gets". Is this because the interpreter couldn't find the object
"a" when first scanning the second line?
File.open("testfile") |aFile| do
print a while a=aFile.gets
end
one will get an error indicating a doesn't exist. This error can be
fixed by adding a line a="" before the print command.
But logically speaking, "print a" should be interpreted after
"a=File.gets". Is this because the interpreter couldn't find the object
"a" when first scanning the second line?