error using 'continue' in my code - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: error using 'continue' in my code (/thread-18905.html) |
error using 'continue' in my code - ilcaa72 - Jun-05-2019 i get the error "continue not properly in loop". i cant find examples that dont use it like this... i want the code to exit and 're-enter' the loop when it encounters 'continue', if you notice before the 'continuation' command, there is a variable assignment which i need. whats the proper use of 'continuation' for this code? thanks def cmp(row): if col['Close'] > col['prev']: col['trade2'] = '+' x = '+' continue elif col['Close'] < col['prev']: col['trade2'] = '-' x = '-' continue elif col['Close'] == col['prev']: col['trade2'] = x RE: error using 'continue' in my code - vindo - Jun-05-2019 You mentioned loop, where is the loop condition in the code you provided? |