Hi this is swat again i want to have a clear concept on bool function why we use it ....how to use it ..and when to use it ....actually what does it mean can anyone explain me about it with some clear examples ..Thanks..
Bool..
Collapse
X
-
Originally posted by swatHi this is swat again i want to have a clear concept on bool function why we use it ....how to use it ..and when to use it ....actually what does it mean can anyone explain me about it with some clear examples ..Thanks..
Code:bool istrue = false; if (istrue) //this code will not be executed istrue = true; if (istrue) //this code will be executed
-
Furthermore, a function can return a bool value. This can be helpful in several situations. For example, suppose you have a character, and you want to check if it is a vowel. You can use a function called isVowel to determine if it is a vowel. The function would look like this:
Code:bool isVowel(char ch) { // Perform your tests here // If ch is a vowel, return true; // If it's not a vowel, return false; }
Code:// code here... if (isVowel(myCharVariable)) { // myCharVariable is a vowel // Do something here } else { // myCharVariable is NOT a vowel // Do something else }
Comment
Comment