[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

dead code

bramu.ss@gmail.com

3/29/2008 1:59:00 AM

Hello,

I started learning Ruby couple of days back while I am practicing
some of the examples I saw that Ruby interpreter doesn't warn me if my
ruby file has dead code. I think its good if Ruby warns me about dead
code when doing interpretation..

if true
puts "its english"
elsif choice == 2
puts "my choice is 2"
end

in the above code elsif block will never get execute. Please give u r
views about this...

Thanks,
Ramu.
3 Answers

Abdelkader Boudih

4/4/2008 10:35:00 AM

0

Ruby is an interpreted language so it don't check what you write only on
run-time!

Writing dead-code is mostly because the programmer is not experimented.
So instead of adding a feature to analyse/warn which will make ruby more
slower, it will be better for the programmers to improve theirs skills!

Regards

bramu.ss@gmail.com wrote:
> Hello,
>
> I started learning Ruby couple of days back while I am practicing
> some of the examples I saw that Ruby interpreter doesn't warn me if my
> ruby file has dead code. I think its good if Ruby warns me about dead
> code when doing interpretation..
>
> if true
> puts "its english"
> elsif choice == 2
> puts "my choice is 2"
> end
>
> in the above code elsif block will never get execute. Please give u r
> views about this...
>
> Thanks,
> Ramu.
>
>
>


Joshua Ballanco

4/4/2008 1:13:00 PM

0

bramu.ss@gmail.com wrote:
> if true
> puts "its english"
> elsif choice == 2
> puts "my choice is 2"
> end

I guess the "correct" answer here would be to write tests for your code.
If this appeared in a method, and you wrote a test for that method, a
tool such as 'rcov' would let you know that the 'elsif' is never
reached.

Cheers,
Josh
--
Posted via http://www.ruby-....

guessy

11/21/2012 5:00:00 PM

0

On Wed, 21 Nov 2012 12:07:30 -0300, RLunfa <gSptloqmd@tipyf.org>
wrote:

>El 19/11/2012 08:29 p.m., Shadow escribi?:
>> On Tue, 20 Nov 2012 00:24:08 +0100, Confusor <confusor@sincorreos.net>
>> wrote:
>>
>> Nice diary.
>> Keep it up mate. You'll lose 200 kgs before your diet's over.
>> []
>
>Yo perd? 200 kg en un solo momento. Dos horas.
>Eran kilos de marihuana que tra?a de Paraguay para enviarles a los
>espa?olitos del orto que escriben en ingl?s
y sobretodos a el cacacazo delhege que llena de m.... cada dia
....y que le vaya bonito

, a ver si de una vez por
>todas aprenden el idioma klingon.
>
>Y contin?an buscando Hispanoam?rica e Iberoam?rica! Juaaaa!!!

>
>A que les den por culo.
>
>Cordialmente,
>RLunfa