while(s=bf.readLine()!=nul)l | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

while(s=bf.readLine()!=nul)l

why it is showing error? String can't be converted to boolean and vice versa

19th May 2017, 9:43 AM
Somnath Ghosh
Somnath Ghosh - avatar
1 Answer
+ 4
I think you might be trying to do a bit too much at once. I believe that assignment statements return a Boolean value. (which is why you need to be careful with the number of equal signs (x=42) will always be true, while (x==42) will respond to your other calculations) So I'd do the readline() first, then go into the loop, that should fix that right up.
20th May 2017, 5:09 AM
Jim
Jim - avatar