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:
The above is the detailed content of what does true mean. For more information, please follow other related articles on the PHP Chinese website!