Skip to main content

Questions tagged [switch-statement]

In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism used to invoke specific blocks of code based on variable contents.

switch-statement
0 votes
0 answers
6 views

On R Identify when a qualitative variable changes from one value to another

On the x-axis I have dates and for each date I have a qualitative variable (colour). I would like to create on R a new df with the date on which my variable changes (e.g. the date from which I turn ...
Pauline Lefranc's user avatar
0 votes
0 answers
6 views

QtCreator: missing shortcut for switching between widgets

For example (in QtCreator) using Ctrl-F to find a piece of text in the opened file – the focus switches from files to search box, I enter the searched text, I enter ENTER, and if existent, the file ...
joerngr's user avatar
  • 111
0 votes
1 answer
41 views

Switch expression vs switch statement which one to use [closed]

Java 14 standardized switch statement and since Java 17 they have enhanced the switch expression to include pattern matching. Is there any guideline to when one should be using switch statement vs ...
JustACoder's user avatar
1 vote
1 answer
36 views

Why those two switch blocks are not equivalent?

enum Foo { bar, baz, } By just simply looking at this code, I thought it would print bar, baz and then barr, bazz void main() { final f = Foo.bar; switch (f) { case Foo.bar: case Foo....
TSR's user avatar
  • 19.3k
0 votes
0 answers
16 views

Trouble Testing Error Handling in Next.js Component with TypeScript and Vitest

Environment: "next": "14.2.3", "vitest": "1.6.0", "@testing-library/jest-dom": "6.4.5", I'm trying to write tests for a Next.js component ...
pop's user avatar
  • 109
2 votes
1 answer
96 views

Is There a Pragmatic Solution to Remove Enum Switches?

The title of this question is a little strange-sounding, but I could think of no better way to word it. My problem is this; I have a type inside a project called AmbiguousType, which is a union in ...
Zenais's user avatar
  • 86
-1 votes
1 answer
40 views

Is there a tool or specific syntax to insert cases into switches with consecutive indices and make the indices below adjust

I have a function that takes an integer and returns a string that is picked by a switch. The strings are part of a coherent text and I want to be able to add cases to the switch whenever I want to ...
user3808217's user avatar
0 votes
1 answer
44 views

Is there a reason an execute pipeline cannot work in a switch activity?

I have a pipeline that has a switch activity - Quite simply, one of the paths is to run an execute pipeline. I know the path works if I put a Wait in there only but if I put an execute pipeline, the ...
Embark6655's user avatar
0 votes
1 answer
67 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 ...
abssyz's user avatar
  • 11
0 votes
1 answer
96 views

Should switch-statement in C++ be used for checking user character input

I am following C++ Programming language book and came upon code similar to one below: bool acceptSwitchWithRetry() { int tries = 0; while (tries < 4) { cout << "Do you ...
DannyBoy's user avatar
0 votes
1 answer
32 views

What is the best way to have different entry points for a list of iterative commands?

I have a list of iterative Python commands: def command_list(start_at): step1 step2 step3 # ... stepN Now I want to start_at different steps in this list of commands and then ...
Sur3's user avatar
  • 31
0 votes
0 answers
9 views

Data corruption problem of using VirtioBlk driver in custom operating system on RISC-V

During the kernel initialization phase, I am able to read data correctly from the boot sector using the VirtioBlk driver. The data read at this stage is as expected. However, after the kernel performs ...
user25279082's user avatar
0 votes
0 answers
10 views

PHP, 2 different interpretations for the same evaluation using if and switch case [duplicate]

in the following code, does anyone know why is the $val === 0  case never running when there's a zero in the $arr array? <?php function plusMinus($arr) { $positiveCount = $zeroCount = $...
eliasdev's user avatar
0 votes
0 answers
47 views

Connecting to a Cisco Switch Using LDAP Authentication via FreeRADIUS

I have a problem with my FreeRADIUS server. I would like to connect to my Cisco switches using LDAP authentication from my FreeRADIUS server, but only for people who are part of a specific group. I ...
Enzo's user avatar
  • 3
-1 votes
1 answer
113 views

The implementation of a switch-statement in ARM assembly seems too minimal

I was learning about how switch-statements work under the hood in C, so I decided to look at the compiled code. From what I understand, C uses a jump table to implement switch-statements. However, I ...
AsianDora's user avatar

15 30 50 per page
1
2 3 4 5
787