What cause the error?

BenTam-3003 686 Reputation points
2022-03-23T08:58:30.703+00:00

Dear All,

I get an error "CS0029 Cannot implicitly convert type 'int' to 'bool'". What causes the error? How to fix it?

Error
185948-error.gif

Definitions of Functions

185940-definitions.gif

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. RLWA32 49,536 Reputation points
    2022-03-23T09:11:00.763+00:00

1 additional answer

Sort by: Most helpful
  1. AgaveJoe 30,126 Reputation points
    2022-03-23T13:36:19.797+00:00

    The "condition" variable in your code is an int not a condition. A condition pattern looks like the following; i < condition;.

    for(int i=0; i < condition; i++)
    

    This information is openly published in the reference documentation provided by RLWA32-6355. It's a bit of a mystery why you are unable to understand the examples in the reference documentation as the docs clearly illustrates each section of the for...loop. The impression is you did not read entire document. Can you explain what you do not understand?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.