Questions tagged [program-flow]
71 questions
1
vote
1 answer
Executing a function after each-loop has completed
Hey there,
I'm working on a jQuery each()-loop containing an ajax-request an a setTimeout. That's giving me some issues with the program flow.
xml_queries: function (data) {
var values = [];
// ...
$.each(data, function(index, value)…

d.hill
- 669
- 3
- 9
- 16
1
vote
4 answers
Programming language without ELSE keyword - is it more complicated?
I'm working on a simple programming language for kids, based on Karel. For controlling program flow, I currently provide these facilities (in pseudocode):
defining parameterless procedures
if [not] EXPRESSION STATEMENT
while [not] EXPRESSION…

Axarydax
- 16,353
- 21
- 92
- 151
1
vote
2 answers
VBA best practices for modules relative to modeless userforms
I came across this similar issue and read the replies: Modeless form that still pauses code execution
I have been attempting to apply in my own situation the suggestion provided by David Zemens. In my situation, I cannot seem to find an approach…

Michael Schulz
- 35
- 3
1
vote
1 answer
routing mvc on the web
I was wondering if anyone could possibly provide me some advice on how i could improve the routing (and/or architecture) to each 'section' of my application. (I'm writing in PHP5, and trying to use strict MVC)
Basically, I have a generic index page…

Steve Rathbone
- 458
- 1
- 5
- 14
1
vote
3 answers
How to consolidate cases in a switch statement?
In a program I am currently working on, I am utilizing a switch statement with many cases yielding the same result. The relevant bit of my current code looks like this:
int[] vinArray = new int[17];
for(int x=0;x<17;x++)
{
v =…
user4740209
1
vote
1 answer
How do I get out of my current scope from void so I can get back to main? What do I need to do?
My error:
|21|error: 'main' was not declared in this scope|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
My actual program is radically different and much larger (hence the unneeded headers). I just wrote this to…

TheOneRing
- 13
- 2
1
vote
1 answer
Conditional script exiting and delegating control
I'm wondering where in a process should the control of a script exiting be placed?
If a function is used to determine whether a script should continue or not, should control, based on the result, be in the caller or the callee?
Are there scenarios…

BIOS
- 1,655
- 5
- 20
- 36
1
vote
1 answer
Listeners and validation/repainting
So I have this problem. I have a program that creates and load files.
When I load a file into my program, I rely on a component listener that tells me when is the specific component "full", and then moves all of the components according to that.
I…

Karlovsky120
- 6,212
- 8
- 41
- 94
1
vote
10 answers
Interrupting program flow in C
I've got a loop running that increments the value of a variable each iteration, and I want to be able to hit a key on the keyboard to stop the loop and report the final value of the variable. Thing is, I can't figure out how to do this in C. I feel…
permagreen
1
vote
1 answer
Returning/Stopping the execution of a function on a keypress in Java
I have a certain function in my program that I want to stop on the press of a key. I have a native keyboard hook set up for that purpose. Right now, I call System.exit(0) when that key is detected. However, I don't want to exit the program, just…

gsgx
- 12,020
- 25
- 98
- 149
0
votes
2 answers
Controlling program flow through memory addressees in c / c++
Sorry if the title is a little obscure, I am not a native speaker and had a bit of trouble formulating my idea...
Assuming I have all the necessary functions and objects for a collection of procedures to be executed compiled and created in memory…

dtech
- 47,916
- 17
- 112
- 190
0
votes
2 answers
Better, or advantages in different ways of coding similar functions
I'm writing the code for a GUI (in C++), and right now I'm concerned with the organisation of text in lines. One of the problems I'm having is that the code is getting very long and confusing, and I'm starting to get into a n^2 scenario where for…

Tomas
- 1,379
- 1
- 13
- 20
0
votes
1 answer
LabVIEW: Correct way to control loop execution from an event structure
The program used has a a few control buttons (start, pause, stop, close) that are supposed to control the execution of a subVI test program. This is mainly a loop doing a certain task.
The question is: what is the proper approach to control the…

femto-code
- 3
- 3
0
votes
3 answers
Why is my boolean value preemptively being returned?
I am working on a login validator and have a class that checks username and password validity. After checking, a boolean variable (isValidLoginCredentials) is updated in the LoginProxy class, which can be fetched by a get method and used for another…

Marco Aiello
- 179
- 10
0
votes
2 answers
Why doesn't python closure work in this scenario?
class Example:
text = "Hello World"
def function():
print(text)
Example.function()
Example.printText() throws this error NameError: name 'text' is not defined
Why doesn't printText() remember the class attribute text?
Does it…

Kun.tito
- 165
- 1
- 7