Converting numerical level to alphabetical

I probably only messed up something simple.
I want to convert a numerical level to alphabetical so instead of 1,2,3 , A,B,C is displayed instead
I decided to make an array and just match them
which actually works when I input a fixed number, such as 3 into it
But when I try to call the actor's current level, the error "undefined local variable or method "actor" is shown
which is very weird because in the default, actor.level is used in draw_text
Ruby:
class Window_Base < Window
  Alph = ("A".."Z").to_a
  def grade
      grade=Alph[6-actor.level]
    return grade
    end
  def draw_actor_level(actor, x, y)
    change_color(system_color)
    draw_text(x, y, 32, line_height, "Result")
    change_color(normal_color)
    draw_text(x + 32, y, 24, line_height, grade, 2)
  end
end
So close!

Code:
class Window_Base < Window
  Alph = ("A".."Z").to_a
  def grade(actor)
      grade=Alph[6-actor.level]
    return grade
    end
  def draw_actor_level(actor, x, y)
    change_color(system_color)
    draw_text(x, y, 32, line_height, "Result")
    change_color(normal_color)
    draw_text(x + 32, y, 24, line_height, grade(actor), 2)
  end
end

I haven't tested this, so apologies if there are syntax errors
Yes. It works. So I actually have to define a fcn that takes on actor and not a new variable.
Thanks a lot.
The mistake you made is that the actor variable is passed around between functions, and is not a class or a global variable. Your grade function didn't know what actor was. If you take a look, you'll see that actor is passed into draw_actor_level - that's how that function was able to use it. So if you create another function that's called from draw_actor_level and you also want it to use the actor object, you have to pass it in.

Original thread: https://forums.rpgmakerweb.com/threads/converting-numerical-level-to-alphabetical.123167/