Do something once

Post

Posted
Rating:
#1 (In Topic #1385)
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
@goodideasdeparment

For donkeys years now, when I need something to happen just once, I have used the

Code (gambas)

  1.  
  2.   If Flag Then
  3.     DoTheOnceThing
  4.     Flag = False
  5.   Else
  6.    DoOtherStuff
  7.  

I just had a 2cent thought, is there a better way?

b

Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Why does 'Flag' have to be static? I have used a similar routine but the other way round. I can't think of a better way: -

Code (gambas)

  1.  
  2.   If Flag Then
  3.     DoOtherStuff
  4.   Else
  5.     DoTheOnceThing  
  6.     Flag = True
  7.  
Online now: No Back to the top
1 guest and 0 members have just viewed this.