Python Forum
error using 'continue' in my code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error using 'continue' in my code
#1
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
Reply
#2
You mentioned loop, where is the loop condition in the code you provided?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  List Creation and Position of Continue Statement In Regular Expression Code new_coder_231013 3 1,602 Jun-15-2022, 12:00 PM
Last Post: new_coder_231013
  Error in continue statement Man_from_India 1 1,522 Feb-02-2020, 02:23 PM
Last Post: Larz60+
  Press a botton to continue the code doug2019 1 1,828 Nov-18-2019, 09:38 AM
Last Post: Gribouillis
  How to continue code after .show() in matplotlib? jasper100125 1 9,246 Sep-09-2019, 02:44 AM
Last Post: luoheng
  How do you make my code continue going ? TheSpalekUk 2 3,516 May-16-2017, 03:50 PM
Last Post: TheSpalekUk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020