Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Using keyboard.read_key to quit a program on a condition

I'm trying to add functionality to my first project, a number guessing game. I want to allow the user to either enter a number to guess, or press escape to exit the program. I've contained an if else ...
FrogLover92's user avatar
0 votes
1 answer
35 views

How do I get a try / exception statement to continue? [duplicate]

I need this to rerun the initial inpput question if it gets a value that is unacceptable. try: hours = float(input("Please enter your hours worked: ")) if hours < 1 : ...
Jennifer Sigler's user avatar
2 votes
2 answers
98 views

How can i put continue in functions inside the loop in C?

I have a C program with many functions nested, all controlled by a main loop, I need to carry out checks in the functions which, if true, must return the control to the main loop, interrupting that ...
Paolo Di Biase's user avatar
0 votes
3 answers
72 views

Conditional If Statements for data format

I would like to skip an iteration of code if, the data in a cell does not match a string - number - number format. For example, the desired format is Apple-34-56. If the array that I defined has a ...
trend's user avatar
  • 9
2 votes
1 answer
55 views

Why does a continue in this ForEach-Object loop cause Powershell to error

When piping the output of a command to a ForEach-Object loop in PowerShell, using a continue statement causes it to error out. Works as expected: ipconfig | ForEach-Object { $_ } Errors: ipconfig |...
DeadChex's user avatar
  • 4,616
0 votes
0 answers
17 views

continue loop within a function, if statement, function, and if statement (javascript)

I'm in a complicated situation in Node.js: HOME: WHILE (TRUE): AWAIT INQUIRER.PROMPT(...) .THEN(FUNCTION(...): IF ... ELIF: AWAIT INQUIRER.PROMPT(...) ....
Eja's user avatar
  • 51
-2 votes
3 answers
296 views

Continue in a do while loop

I have a do-while loop designed to get a number from user input in the console. I included error checking and many optional variables to make it versatile (i.e. min and max allowed values, an array of ...
moshesilver's user avatar
5 votes
3 answers
660 views

Using continue/return statement inside .ForEach() method - is it better to use foreach ($item in $collection) instead?

It's fairly well documented that foreach processing speed varies depending on the way a foreach loop is carried out (ordered from fastest to slowest): .ForEach() method foreach ($item in $collection) ...
Paul π's user avatar
  • 438
1 vote
1 answer
68 views

Continue has no effect in for loop?

I'm a beginner trying to solve this kata: In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it ...
nesfel's user avatar
  • 13
-1 votes
3 answers
139 views

Restart foreach loop if condition is satisfied on last iteration [duplicate]

How do I restart a foreach loop when I reach the last index and some other condition? The loop needs to run again, instead, it just stops. foreach ($getUsers as $index => $user) { $userID = ...
ABigBird's user avatar
2 votes
1 answer
36 views

Double N to break out asking user if they want to run again and promt again for new input

I am trying to ask a user if they would like to try again a new computation, I used old code from another lab I had but can't seem to get it to adjust proper for this new one. My problem is that when ...
Spongebuild's user avatar
0 votes
1 answer
47 views

How to fix this loop or function related issue in python?

I am a beginner firstly. I just wrote this simple code but I have one problem. Whenever you guess the wrong number once and try to stop playing, it just doesn't respond to you and continues whatever ...
Vald1z's user avatar
  • 9
-7 votes
2 answers
111 views

Continue statement

The continue statement is for skipping the iteration but it doesn’t work as I expect. Here is my code: int i = 0; do { if(i== 10)continue; printf("\n This is = %d",i); i++; } while ...
user3737377's user avatar
-2 votes
2 answers
126 views

Can someone explain the output of this code [closed]

// Online C++ compiler to run C++ program online #include <iostream> using namespace std; int main() { for (int i = 0; i<=15;i+=2){ cout<<i<<" "; ...
Anshika Verma's user avatar
0 votes
1 answer
32 views

How do I go back to the menu, and continue the loop if the keyword is not correct [duplicate]

while True: print("Menu:") print("1. Add Task") print("2. Display Tasks") print("3. Update Task Status") print("4. Exit") ...
Weedify's user avatar
1 vote
1 answer
160 views

Continue python script even if urllib.request encounters HTTP error codes

I have a python script that accepts a CSV file containing a list of URLs. The CSV file looks like this. name, url google, https://httpstat.us/200 yahoo, https://httpstat.us/401 bcs, https://httpstat....
Ldd's user avatar
  • 45
2 votes
3 answers
2k views

Why is tqdm progress bar not working in a for loop containing a continue statement?

So I'm using the Python tqdm library to display a progress bar in the terminal when I execute a Python script that includes a for loop. For example, when I do this: import time from tqdm import tqdm ...
Swike's user avatar
  • 190
-1 votes
1 answer
346 views

How can I fix 'continue not properly in loop' error in my Python while loop? [closed]

I'm trying to make it so that my program will write the input again if the answer isn't within 5 to 10 but when I try to use while True and continue it says that the continue is not properly in loop. ...
viktor's user avatar
  • 1
0 votes
0 answers
58 views

How do I skip a file that gives a ReferenceError in a long list of files that I need to continue to do something with?

Within a python framework, I am attempting to store several files within the user's working directory that meet certain criteria; these files are created and destroyed by different users at will, so ...
Phoenyx's user avatar
4 votes
1 answer
130 views

Understanding a Julia statement comprising == && increment and continue

I am trying to translate some Julia routine into C (C#, C++). I fail to understand the particular line n == n0 && (n+=1; continue) in the following loop. ret1, ret2, n = 1, 0, 0 while n < ...
Douar Gwenn's user avatar
0 votes
2 answers
274 views

JavaScript jump to label

I'm trying to make a function that validates user input and return true if there are no mistakes or false (and display a message) if there is a problem. If an error found, there is no need to check ...
bbProg's user avatar
  • 7
0 votes
1 answer
203 views

Refactoring loop iteration logic into helper function with continue statements

I have a function that looks (simplified) like the following: void function() { // compute n int n = .... for (int i = 0; i < n; ++i) { if (certain condition is met) { if (another ...
roulette01's user avatar
  • 2,384
0 votes
1 answer
566 views

PowerShell script doesnt continue after reboot

I am pretty new to PowerShell scripting so I wanted to write a script that helps our apprentices in setting up new laptops for our customers. This script should rename the computer, then restart it ...
Slime's user avatar
  • 3
-2 votes
1 answer
93 views

How to break from the Catch block after throwing BadRequestException using C#

I have a method which needs to break after the BadRequestException() is thrown. Currently after BadRequestException() is thrown, frontend shows loading bar buffering infinitely. Please find my code ...
Philip's user avatar
  • 85
0 votes
1 answer
73 views

How to skip data in for loop while using a function

I need to skip the data using continue while using for loop def skip_data(i): if i == 5: continue else: print(i) for i in range(0,10): skip_data(i)
Ajay Kk's user avatar
  • 13
-2 votes
1 answer
121 views

Continue statement in python does not work [closed]

i=0 while i<10: if i==2: continue print(i) i+=1 #0 #1 #This is the output i get The code stops at 1 and does not execute further
SAARA UNNATHI R's user avatar
0 votes
3 answers
508 views

Why Continue in While loop is not working in Python?

Hello while I was practicing while loop in Python my code was not giving any outputs whatsoever. I am learning python from books only, so it may sound basic: but where is the problem in this code? I ...
Sanjib Dey Choudhury's user avatar
0 votes
0 answers
77 views

Different outputs for different IDEs for same c++ program using continue keyword [duplicate]

For the following c++ program : #include<iostream> using namespace std; int main() { int i=1; while(i<=10) { if(i==5) continue; cout<<endl<<i; ...
indomitable_fire_2010's user avatar
-1 votes
3 answers
775 views

In C, how do i break out of a nested inner loop but continue the outer loop?

This is my first time posting a coding question on any website, so apologies if i dont do a great job. Constructive feedback is very welcome. I am working on the tideman problem in cs50, if that is ...
user20633421's user avatar
0 votes
1 answer
836 views

Continue a if statement in C++ [duplicate]

To reduce indentation in my code I want to skip a if statement if a condition is met. Let this be the following code: if (foo()) { if (bar()) if_continue; // continue the code and dont ...
Samuel's user avatar
  • 477
0 votes
2 answers
45 views

Why does the code not show the numbers that are less than 15? Break loop

a program that will iterates over each number in a the list then the if statement will check whether the iteration/number is greater than 15 then the loop will stop, otherwise the number from the list ...
user avatar
-2 votes
4 answers
51 views

'Continue' Function in Python

I have a question about the 'continue' function in Python. I wolud like to skip 'Antarctic' in the following list: continents = = ["Afrika", "Antarktic", "Asien", "...
Cihan's user avatar
  • 11
0 votes
1 answer
394 views

Continue while loop when the function catches exception

I have multiple functions inside a while loop. Each of these functions has a try/except block to catch Exception. Basically, my while loop is perpetual, so if one of my functions catches an Exception, ...
QFi's user avatar
  • 291
0 votes
1 answer
1k views

Reduce the total number of "break" and "continue" statements in this loop to use one at most in Javascript

I am refactoring code written by another developer. On SonarQube, the error thrown is that I need to "Reduce the total number of "break" and "continue" statements in this loop ...
Spencer Benson's user avatar
-3 votes
2 answers
77 views

Could I get clarification on the continue statement?

I want clarification on the continue statement. #include <stdio.h> int main (void) { int i; while (i < 10) { if (i == 4) { i++; continue; } ...
ddp17's user avatar
  • 41
1 vote
3 answers
851 views

Simon Says challenge activity

I am brand new to coding and working my way through an intro class via Zybooks. This challenge activity is asking me to add one point to user_score for every letter that is a match and break the loop ...
SwanSong's user avatar
0 votes
1 answer
173 views

How to use Continue For within an inner function in VB.NET

I have an outer function which contains a loop and an inner function where I'm trying to use Continue For. How can I use the Continue For within the inner function. For example: Public Function Create(...
Rich's user avatar
  • 6,529
-1 votes
1 answer
43 views

i need this continue to skip the entire while loop but it skips just the if loop (i think)

while continue_bool: try: name = input("Name (str): ") if (name in used_names): print("This name is already in use") ...
Daniel Statler's user avatar
0 votes
3 answers
61 views

Python continue and break usage [closed]

I need to solve the following problem and I assume I have to use continue and break logic. I have to create an empty to do list and iterate over the dictionary of tasks. I need to add tasks that ...
Mdick's user avatar
  • 37
-3 votes
5 answers
108 views

I can't put "continue" command in a definition?

Let's say, def sample(): if a==1: print(a) else: continue for i in language: a=i sample() I want to use this function in a loop, but the continue command gives me an ...
Ahmet Said Oyanık.'s user avatar
0 votes
2 answers
62 views

While Loop- Continue Statement printing duplicate values

I am writing the following code in Python to execute a program that 'skips' out numbers in a range of 1-10 which are divisible by 3: for i in range(10): while i % 3 == 0 : i = i + 1 ...
Tech_Nut's user avatar
1 vote
1 answer
241 views

Powershell Understanding "continue"

So in the spirit of this short but sweet tutorial I'm trying to filter out disabled user and only work on the "Enabled" users with this code. (FYI Search-ADAccount needs elevated) $EXPusers =...
4evernoob's user avatar
  • 115
1 vote
1 answer
263 views

Why continue statement not execute the below lines of codes in infinite loop

#include<stdio.h> int main() { int i=0; for(;;) { if(i==10) { continue; } printf("%d",++i); } } This above code makes the output as without print anything.But by ...
SARAN V's user avatar
  • 13
3 votes
1 answer
270 views

Explanation of RAD Studio source code markers/visualizations

I was interested to know if the code markers shown at the end of some lines (see screenshot) are explained or documented anywhere (for RAD Studio 10.4). I notice that the first 3 (for Halt, Continue ...
Paul's user avatar
  • 41
-1 votes
2 answers
95 views

(cs50)not getting output for the given code. can anyone please check this out?

my code counts the number of letters from the given string(excluding white space). cs50.h is a library which consists of get_string() function which takes input from user. the code is compiling but ...
Pratheek Reddy's user avatar
0 votes
3 answers
125 views

Loop start from 2 instead of 1 in python continue statement

I am learning continue statement in python while loop. If I run a following code, the output shows from 2 instead of 1. a = 1 while a <= 8: a += 1 if a == 5: ...
Imtango30's user avatar
  • 143
0 votes
2 answers
53 views

How to fix string out of index range when customizing looping "input()" in python?

I'm experimenting with the input() function. I'm trying to make the code to loop for user input and continue or break the loop based on the user input. while True: line = input("> ") ...
Faez's user avatar
  • 1
0 votes
1 answer
144 views

I have written a solid calculator but I missed the part where I can loop it?

# Python program for simple calculator # Function to add two numbers def add(num1, num2): return num1 + num2 # Function to subtract two numbers def subtract(num1, num2): return num1 - num2 #...
David Heydenrych's user avatar
0 votes
0 answers
79 views

Index out of range while web scrapping yahoo finance news

here is the code, after importing libraries and defining values : y = 0 while y < 20: headline =(soup3.find_all('div',{'class': 'Ov(h) Pend(44px) Pstart(25px)'})[y].find_all('a')[-1].text) ...
momo's user avatar
  • 11
-1 votes
2 answers
223 views

How do I exit out from an if-statement in a for loop?

I want the program to run the if statement for the first iteration of the for loop, and then ignore it for the rest of the iterations. How do I do that? Continue and break didn't work either and led ...
Bongo Man's user avatar
  • 109

1
2 3 4 5
15