whats the use of flag in coding

Nov 12, 2008 at 1:10pm
closed account (1Ujz3TCk)
please tell
Nov 12, 2008 at 5:16pm
In a programming context, "flag" means the same thing as "boolean". Hence, a flag value is a boolean value: true or false.

Hope this helps.
Nov 12, 2008 at 6:38pm
an example is like
1
2
3
4
5
6
7
8
9
10
11
bool isTrue=true; // set true so it enters the loop
int number=0;
while(isTrue)
{
    number+=1;
    if(number ==5)
    {
         //change flag to false so the loop doesn't execute any more
         isTrue=false;
    }
}
Last edited on Nov 12, 2008 at 6:39pm
Topic archived. No new replies allowed.