Hi!
I trying to make a game. But i wonder how the end command work? Why i must have 2 end in love.draw function ?
How end work.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How end work.
Exactly where did you see that you needed two ends with love.draw?
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: How end work.
Code: Select all
function love.draw()
love.graphics.draw(grill, 500)
love.graphics.draw(bakrund)
if burgare then
love.graphics.draw(burgare, 40)
love.graphics.draw(raw, 50)
end
end
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How end work.
Let me fix your identation first:
The keywords "function", "if", "do", "while", "for" need their blocks to be closed with "end".
In your case, one end is for the if block, the other for the whole function.
Code: Select all
function love.draw()
love.graphics.draw(grill, 500)
love.graphics.draw(bakrund)
if burgare then
love.graphics.draw(burgare, 40)
love.graphics.draw(raw, 50)
end
end
In your case, one end is for the if block, the other for the whole function.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: How end work.
Thank you so much Zorg.
Who is online
Users browsing this forum: No registered users and 8 guests