2

I am looking at PICO-8 for the first time.

This simple IF statement give me the error "UNCLOSED FUNCTION AT LINE 1".

function MYTEST() 
  local x = 1
  if x==1 then
    print("x==1")
  else if x==0 then
    print("x==0")
  end
end

I admit the function is of no use but the interpreter won't allow it to run.

Why?

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
Rob O'Doherty
  • 549
  • 3
  • 14

1 Answers1

4

As mentioned in the comments, changing the code from else if to elseif makes it work.

Alternatively, add an end before the first end:

function MYTEST() 
  local x = 1
  if x==1 then
    print("x==1")
  else if x==0 then
      print("x==0")
    end
  end
end
lhf
  • 70,581
  • 9
  • 108
  • 149