Skip to main content

Questions tagged [control-structures]

A control structure is a statement that changes the control flow in a program, based on the evaluation of one or more conditions. Common examples include the 'if-then-else' statement, the 'case-switch' statement, 'for' loops, and 'while' loops.

-2 votes
4 answers
274 views

Programming languages traditionally have blocks that specifically cater to controlling iteration. There is the simple while-loop: while (i < 3) {...}; Then there is the more complicated for-loop: ...
Steve's user avatar
  • 12.7k
0 votes
0 answers
89 views

Not many architectures have skip instructions today. They are (usually) conditional instructions that skip the following instruction. A few architectures having these: PIC14, with its btfss and btfsc ...
Omar and Lorraine's user avatar
1 vote
3 answers
270 views

The following code works and is clear, but it's also verbose. I suspect that there's a way to make it more terse, so that it could be skimmed quickly and it'd be more obvious what's happening. // The ...
Ian Dunn's user avatar
  • 125
2 votes
4 answers
253 views

In our project there are deep and lengthy if-else structures which can be significantly shortened by a simple rearrangement. To me the shorter version would be easier to understand also. As an ...
riskop's user avatar
  • 129
0 votes
3 answers
579 views

Basically, I want to know how to simulate while and if if I'm handling the control flow myself through an array of instructions. The while loop can be simulated by if, as seen with assembly branching ...
Lance Pollard's user avatar
4 votes
4 answers
170 views

Been given an awkward design challenge, and I'm not sure how best to handle it. The scenario is this: in the system there's a concept of "Client". Each client has various bits of supporting metadata ...
Bob Tway's user avatar
  • 3,636
2 votes
2 answers
103 views

Inside our UI there's an option to select something from a dropdown. Depending on what you choose inside that menu the rest of the fields inside the UI change accordingly. At the moment we handle it ...
cgew85's user avatar
  • 123
5 votes
6 answers
5k views

I've been set a challenge that I'm trying to get my head around, but am struggling with the best (or 'correct') way to implement it. The challenge is to create a simple console app written in Go that ...
Hexodus's user avatar
  • 77

15 30 50 per page