Expecting kEND

I know this is a literal translation to keyword end, but unsure
sometimes (right now that is frequent) of where end goes. I know
there is one to end the method definition.
However adding one after the if and one after the else , or just one
for both conditions doesn't seem to help.

def roman num

  if num <= 4
    i = 1
    rn = (num/i)
    rn.times do
    print "I"

  else num >= 5 && num <= 9
    v = 5
    rn = (num/v)
    rnm = (num%v)
    rn.times do
      print "V"
    rnm.times do
      print "I"

end

You need matching ends for def, if and do...

def roman num

if num <= 4
   i = 1
   rn = (num/i)
   rn.times do
     print "I"
   end

else num >= 5 && num <= 9
   v = 5
   rn = (num/v)
   rnm = (num%v)
   rn.times do
     print "V"
   end
   rnm.times do
     print "I"
   end
end

end

···

On 6/25/06, Dark Ambient <sambient@gmail.com> wrote:

I know this is a literal translation to keyword end, but unsure
sometimes (right now that is frequent) of where end goes. I know
there is one to end the method definition.
However adding one after the if and one after the else , or just one
for both conditions doesn't seem to help.

def roman num

  if num <= 4
    i = 1
    rn = (num/i)
    rn.times do
    print "I"

  else num >= 5 && num <= 9
    v = 5
    rn = (num/v)
    rnm = (num%v)
    rn.times do
      print "V"
    rnm.times do
      print "I"

end

--
Mark Van Holstyn
mvette13@gmail.com
http://lotswholetime.com

Also your else should be elsif, assuming you only want that piece of code to execute when num >= 5 && num <= 9

Mark Van Holstyn wrote:

···

You need matching ends for def, if and do...

def roman num

if num <= 4
  i = 1
  rn = (num/i)
  rn.times do
    print "I"
  end

else num >= 5 && num <= 9
  v = 5
  rn = (num/v)
  rnm = (num%v)
  rn.times do
    print "V"
  end
  rnm.times do
    print "I"
  end
end

end

On 6/25/06, Dark Ambient <sambient@gmail.com> wrote:

I know this is a literal translation to keyword end, but unsure
sometimes (right now that is frequent) of where end goes. I know
there is one to end the method definition.
However adding one after the if and one after the else , or just one
for both conditions doesn't seem to help.

def roman num

  if num <= 4
    i = 1
    rn = (num/i)
    rn.times do
    print "I"

  else num >= 5 && num <= 9
    v = 5
    rn = (num/v)
    rnm = (num%v)
    rn.times do
      print "V"
    rnm.times do
      print "I"

end