blind bug in script (extra end statement)

can someone see why this script will only run if i bog it with end statments

class Scene_Bestiary < Scene_MenuBase def start super @list_window = Window_EnemyList.new(0, 0, 200) end class Window_EnemyList < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) data = [] self.index = 0 activate refresh end def refresh make_item_list create_contents draw_all_items end def make_item_list @data = $data_enemies.compact end def item_max @data ? @data.size : 1 end def draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.name) end endendend     ^^^  this is as far as i see an unneeded end statement
I've moved this thread to RGSSx Script Support (RGSS3 Scripts is for sharing scripts you have made, not for asking for help). Please be sure to post your threads in the correct forum next time. Thank you.

Take another look. Your indentation is wrong. The end statement is absolutely needed.

You've got this:

Code:
  if item    rect = ...    draw_text ...end
That end needs to be indented, as it belongs to the if, not to the def. And the two following end statements also need to be indented.
You also don't have an end after each of your classes. I see one missing right away after your def start  code end, as you need that 2nd end to tell it is the end of that class. Right now you have a class inside a class, which I don't think is what you want. 
oh yeah, I didn't even notice that! So one of those end's needs to be moved up so it belongs to the first class.

Original thread: https://forums.rpgmakerweb.com/threads/blind-bug-in-script-extra-end-statement.43261/