Discussion: C++ 2 Ruby
Afficher un message
Vieux 09/06/2008, 22h38   #3
Jed Kowalski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: C++ 2 Ruby

Avdi Grimm wrote:
> You might have better luck asking for with specific sections of
> code, rather than asking us to rewrite a whole program. Try doing a
> best-guest translation to Ruby on your own, and asking about the parts
> you have trouble with.


ok so, here's the first problem:
def initialize (cen, ile, nn)
@price=cen
@amount=ile
@name=nn
@bought=0
end


def change(x)
amount--
bought++
return x-price //WHATS WRONG HERE?
end

and I get:

gut.rb:13: void value expression
return x-cena
^
gut.rb:13: syntax error, unexpected tIDENTIFIER, expecting kEND
return x-cena

--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
 
Page generated in 0,05613 seconds with 9 queries