How can I initialize multiple variables of different type in a C# for loop? -


this did i'am not sure if right

int e = 1; int m = 500; ( e = 1; m = 500; e < 4; m >= 300; e++; m-100;) 

what trying is possible, have few pieces wrong.

you can execute multiple statements in each "area" of for-loop structure, need separate them differently. valid loop this:

for ( e = 1, m = 500; e < 4 && m >= 300; e++, m -= 100) { } 

notice in first , third blocks, use commas separate initialization , increment/decrement statements. second block has single conditional, used && , them together.

i fixed "m" decrement statement modified m. subtraction operator non-destructive, wouldn't modify n original code.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -