--------------020906080607030605050207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Simon, Simon Strandgaard wrote: > On 4/9/06, Joern Dinkla <joern / dinkla.net> wrote: > [snip] > >>I programmed it to learn Ruby and to improve my coding skills, because i >>have less than 2,5 weeks of experience with Ruby. I bought the > > [snip] > > > You are doing good. Thank you very much. > > sometimes you use parentesis and other times you don't. > def test() is the same as def test > if(cond) is the same as if cond > .length() is the same as .length > Yes, sometimes i forgot them. For me the code is easier to read when i add parenthesis to functions (in definitions and calls). I think this is because i am still a newbie. But if i do not put the parenthesis at the end i do not know if its an accessor to an attribute or a function. But for me there is the exception if a block follows a function call. list.each() do |x| ... end simply does not look as good as list.each do |x| ... end > > > File.open(filename) do | file | > file.each_line() do |line| > > is the same as > > IO.readlines(filename).each do |line| I will use the File.foreach method as suggested by Christian Neukirchen. > > def initialize(mc il) > if mc.nil? > @mc arkovChain.new() > else > @mc c > end > end > > is the same as > > def initialize(mc il) > @mc c || MarkovChain.new > end > Yes, that looks better. > > -- > Simon Strandgaard > > Best regards, Joern -- Joern Dinkla, http://www.dinkla.net --------------020906080607030605050207 Content-Type: text/x-vcard; charset=utf-8; name oern.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename oern.vcf" begin:vcard fn;quoted-printable:Jörn Dinkla n;quoted-printable:Dinkla;Jörn adr;dom:;;;Hamburg email;internet:joern / dinkla.net tel;cell:+49(0)179 70 10 60 5 x-mozilla-html:TRUE version:2.1 end:vcard --------------020906080607030605050207--