Home  >  Article  >  what does true mean

what does true mean

little bottle
little bottleOriginal
2019-05-15 15:01:0337835browse

There are many words in computer programming languages ​​that have special meanings, such as false and true. Do you know what they generally mean? Please listen to what the editor tells you below.

In fact, true in programming languages ​​is generally defined as "true", while false represents "false". They are usually used to judge or mark a certain variable.

Please look at the following piece of code:

#include <iostream>
using namespace std;
void changeFlag(bool &flag);
int main()
{
    bool flag = true;    //用true对flag进行标记
    changeFlag(flag);
    if(-1000)            //判断—1000是否为不为0
        cout<<"-1 is true"<<endl;
    else
        cout<<"-1 is false"<<endl;
    cout<<"flag = "<<flag<<endl;
    return 0;
}
void changeFlag(bool &flag){
    flag = !flag;
}

Running results:

what does true mean

The above is the detailed content of what does true mean. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What is net framework?Next article:What is net framework?