Jump Statement in Python
def get_result():
result = 10
if result > 0:
return result # Return a positive value
for i in range(1, 6):
if i == 3:
continue # Skip the remaining code for i=3
print(i, end=" ")
if i == 4:
break # Exit the loop when i=4
print(get_result(), end=" ")
# Python does not support goto
Output
1 2 4 10
Jump Statements in Programming
Jump statements in programming allow altering the normal flow of control within a program. These statements provide a way to transfer the execution to a different part of the code, facilitating conditional exits, loop control, function return, or unconditional jumps.
Table of Content
- What is a Jump Statement?
- Break Statement
- Continue Statement
- Return Statement
- Goto Statement
- Jump Statement in C
- Jump Statement in C++
- Jump Statement in Java
- Jump Statement in Python
- Jump Statement in C#
- Jump Statement in Javascript
Contact Us