Button function

Hello

I am new here. And my programming skilz are not that good.
I need to programme a function but I don't have a clue how I should start at this part:
When the button is double clicked. Than you click the button once or you read the IR sensor.

I can programme the part of double click and how I need to read the IR sensor.
Buth I don't know how I can do the part, you can only do something when the first thing is done.

Can somebody help me?

Thank you!

I don't know how I can do the part, you can only do something when the first thing is done

When you do the first thing set a boolean variable, maybe named doneFirstThing, to true. Only do the second thing when doneFirstThing is true