Yes, you can use the keyword
break like that.
EnjoY_Y wrote:
'Use of unassigned local variable 'novon'' is error which I got after I tryed to use novon for something.
I interprete your statement here so that you get that error if you try to use
novon
after the for-loop.
Since using an unassigned variable would lead to unpredictable results, the compiler doesn't allow this to happen in the first place.
You didn't initialize
novon
with a value before the for-loop and the compiler doesn't rely on the possibility that the code in your if-statement will be executed at some point. Maybe you planned for this to always happen but the compiler sees the possibility that it will still not have a value assigned after the for-loop.
So you need to assign an initial default-value to
novon
where you declare it. If it shouldn't get a new value assigned in the loop/if-statement then it will still have that initial value after the loop.
edit: reworded.