All Questions
Tagged with switch-statement loops
366
questions
0
votes
1
answer
69
views
Which is better in this scenario - if else loop or case in shell scripting?
I am trying to write a shell script which has a part where I have to use some kind of loop to execute some commands if condition satisfy.
I want to understand what is the best way to approach this ...
0
votes
0
answers
46
views
Powershell menu that loops when the script is launched via PSEXEC (with display return via CMD)
We have Powershell scripts which are run on remote workstations via a private tool (and via PSEXEC).
All feedback (messages, errors) is given in the CMD window.
The problem is that when a script uses ...
1
vote
2
answers
66
views
How to modify while loop to print extra print statement in next loops? [java]
These current associationMenu uses switch statements to implement methods corresponding to the char input by the user. The while statement loops over untill X is read.
I want to make some ...
-1
votes
1
answer
84
views
Is there a way to print error message when a user presses the "enter" key instead of throwing an exception or a primitive type error(char to str)?
I am currently working on a project in my first Java class. I am writing a program for a mock company that allows for various user inputs depending on user need for animal registration. The info ...
0
votes
1
answer
518
views
How to make switch case button in swiftUI with action and title
I want to make a button list with different actions in the switch case method in swiftUI.
struct dashboard: View{
var categoriesText = ["My Orders", "Payments", "...
-1
votes
1
answer
139
views
loop use in switch case autoit
I have a thousands mini tools, I am trying to create a menu by using Autuit. I have to define thousand functions and case and variable how i can make it easy.
here is my code how can use loop for ...
0
votes
0
answers
444
views
How to Return to a previous step in a C program upon user input?
I want go back to the previous step when user input is invalid. i already given 3 options to select in Dates. when user input another number except 1,2,3 i want to display something like "invalid ...
-3
votes
1
answer
51
views
Looping through a dictionary<int, int[]> and getting unexpected results
I have been working with C# and Visual Studio creating an app to assist with my Game Mastering.
Working on this part of the app, I am having trouble getting the answer I expect.
I have tried several ...
1
vote
1
answer
142
views
Parsing CSV file with `foreach` produces duplicate entries in the output
I'm encountering a basic issue when writing the following PowerShell script and using loops and branching. It appears that I'm missing something very simple here, but right now I don't understand how ...
0
votes
1
answer
40
views
i just did switch-case in a switch-case... in a switch-case. There maybe be a better way to do it right? [closed]
import java.io.*;
import java.util.Scanner;
public class MyGame {
public static void main(String argv[]) throws IOException {
String prompt;
Scanner scanner = new Scanner(System. ...
0
votes
1
answer
80
views
C Program, Array inside a case in continuous Switch Menu loop
My array inside case 4 in looping Switch Menu doesn't print/display the value of the last array when the user input goes beyond array[4].
I tried to take the case 4 out and make it a single program to ...
0
votes
1
answer
52
views
Another alternative way of writing my "Try Again" loop?
So I have a code that finds the smallest number without an array. I need to ask if the user wants to try again. So I used Switch/Case statements with goto statements. My problem is that when the first ...
0
votes
2
answers
95
views
Nested switch() - case issue in C. Why are <ctype.h> functions not working the way I would like them to?
I have been trying to understand why this is not working properly for the past five hours.
The question explicitly asks for the use of switch() and no if-else (or of the likes) to count the number of ...
0
votes
1
answer
221
views
how to do a loop in powershell, including powershell Switch?
What is the best way, to make a loop in powershell? including powershell Switch,
So that every time you finish, you will return to the Switch to be rerun
example:
$list_of_scripts=Read-Host "...
1
vote
1
answer
57
views
Switch always runs default inside a while loop [duplicate]
#include<stdio.h>
int main()
{
char a;
do {
printf("\n enter letter a,b or c: ");
scanf("%c", &a);
switch (a)
{
case 'a' :
printf(&...