Anyone can guide me how the following statement executes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Anyone can guide me how the following statement executes

bool result=true; if(result) { cout<<"true"; }

28th Jun 2017, 9:39 AM
Muhammad Kaleem Ullah
Muhammad Kaleem Ullah - avatar
5 Answers
+ 5
if statement tests for true condition so if(result) is the same as writing if(result == true)
28th Jun 2017, 9:51 AM
jay
jay - avatar
+ 5
You are welcome!
28th Jun 2017, 9:53 AM
jay
jay - avatar
+ 4
if result is true print true
28th Jun 2017, 9:47 AM
jay
jay - avatar
+ 2
is it mean condition is true then it it true?
28th Jun 2017, 9:47 AM
Muhammad Kaleem Ullah
Muhammad Kaleem Ullah - avatar
+ 2
Thanks Bro.
28th Jun 2017, 9:52 AM
Muhammad Kaleem Ullah
Muhammad Kaleem Ullah - avatar