control-flow Questions
2
Solved
I’m trying to get get my macro to do an extra evaluation of its result before returning it. Can this be done without eval?
I'm trying to solve the problem in exercise 4 below:
Define a macro nth-...
Squint asked 11/5, 2019 at 15:6
3
Solved
In PHP you can access both the names and values of an array in a for loop with
foreach ( $array as $key => $value ) {
Is there anything comparable in R, when looping over named lists?
Proportionable asked 20/6, 2012 at 4:21
2
Solved
I would like to know if there is an else statement, like in python, that when attached to a try-catch structure, makes the block of code within it only executable if no exceptions were thrown/caugh...
Mccarthy asked 25/1, 2017 at 1:14
1
I am drawing control-flow graphs for Python programs and would like to influence which kind of edges should not be crossed over. Is there a way to do this?
Consider this simple Python program:
t...
Nevis asked 25/11, 2018 at 15:6
1
Solved
I want to prevent my UIButtons from emitting RX tap events until some control stream indicates that it is ready. I want buttons to be disabled again if the control stream reverts back to not ready....
Kryska asked 9/9, 2018 at 11:4
6
Solved
I have an AST derived from the ANTLR Parser Generator for Java. What I want to do is somehow construct a control flow graph of the source code, where each statement or expression is a unique Node. ...
Dosi asked 18/9, 2008 at 13:30
1
Solved
I have a method that, depending on a predicate, will return one future or another. In other words, an if-else expression that returns a future:
extern crate futures; // 0.1.23
use futures::{futur...
Fertilization asked 16/8, 2018 at 21:45
4
Solved
I have the following code:
public String testExitPoints() {
boolean myBoolean = false;
try {
if (getBoolean()) {
return "exit 1";
}
if (getBoolean()) {
throw new RuntimeException();
}
} f...
Glaudia asked 5/8, 2015 at 10:31
6
Solved
According to the perl manual for for last (http://perldoc.perl.org/functions/last.html), last can't be used to break out of do {} loops, but it doesn't mention an alternative. The script I'm mainta...
Unheard asked 6/12, 2010 at 18:13
7
Solved
This one just came up: How do I break out of an if statement? I have a long if statement, but there is one situation where I can break out of it early on.
In a loop I can do this:
while (something ...
Adeliaadelice asked 11/6, 2013 at 20:55
4
Solved
Because Swift does not have abstract methods, I am creating a method whose default implementation unconditionally raises an error. This forces any subclass to override the abstract method. My code ...
Saum asked 7/1, 2015 at 21:40
3
Solved
I have a variable v in my program, and it may take any value from the set of values
"a", "b", "c", ..., "z"
And my goal is to execute some statement only wh...
Nedry asked 13/10, 2014 at 9:45
3
Solved
I'm almost a complete programming beginner and I've started to go through a Swift ebook from Apple.
The things I read are pretty clear, but once you start to experiment things get tricky :).
I'm ...
Alt asked 9/6, 2014 at 7:34
11
Solved
I was wondering if there is a big performance difference in languages, whether you should put the more likely to be executed code in the if or in the else clause. Here is an example:
// x is a ran...
Rummage asked 1/8, 2012 at 16:37
2
Solved
Forth famously allows users to alter the language by defining new words for control flow (beyond those given by the standard: DO, LOOP, BEGIN, UNTIL, WHILE, REPEAT, LEAVE IF, THEN, ELSE, CASE, ENDC...
Speakeasy asked 30/6, 2017 at 17:31
1
Solved
I'm looking to be able to yield from a number of async coroutines. Asyncio's as_completed is kind of close to what I'm looking for (i.e. I want any of the coroutines to be able to yield at any time...
Triaxial asked 7/6, 2017 at 7:8
4
Solved
I need a tool for generating control flow in java, but not a visual draw, something that I can work with like with path conditions or so.
Anyone ?
Eratosthenes asked 23/1, 2011 at 12:45
3
Solved
I'm looking for a solution to waiting for an event to happen before sending a HTTP response.
Use Case
The idea is I call a function in one of my routes: zwave.connect("/dev/ttyACM5"); This funct...
Inefficiency asked 18/12, 2016 at 19:54
1
Solved
Can I translate an Abstract Syntax Tree directly into SSA form, or will I need to create a control flow graph and then create the Static Single Assignment form from said CFG?
And in the context of...
Evacuate asked 20/12, 2016 at 6:37
2
Solved
I looked at the docs from Kotlin website, there are only two Control-Flow expressions: if and when.
For if:
the expression is required to have an else branch
For when:
The else branch is e...
Vescuso asked 28/11, 2016 at 8:1
3
i have code like this
switch thing {
case thisThing:
do thing #1
do thing #2
case thatThing:
do thing #2
do thing #3
case anotherThing:
do thing #4
default:
default
}
So, EVERY case ha...
Owing asked 3/8, 2016 at 19:6
7
Solved
I am trying to parse dates using SimpleDateFormat. As my service takes in multiple date formats, I have adopted this approach:
String[] formats = {
"yyyy-MM-dd'T'HH:mm:ss.SSSZ",
"yyyy-MM-dd'T'HH...
Fishbolt asked 19/7, 2016 at 20:41
8
Solved
How can I transfer control to a specific line in Swift code?
In Objective-C I would do something like the following, using goto
if(a==b)
{
goto i123;
}
else
{
goto i456;
}
NSLog(@"the not reach...
Ignition asked 8/2, 2015 at 18:32
4
Solved
Is it possible to write something like this, or do we have to revert back to manual null checking in Kotlin?
val meaningOfLife : String? = null
when meaningOfLife {
exists -> println(meaningO...
Hower asked 3/6, 2016 at 9:24
2
I need to recurse over a tree to perform operations on specific nodes using async operations. How can I control flow so I have access to the nodes when it's done?
Here's an example situation:
dat...
Bookstore asked 28/3, 2013 at 15:18
© 2022 - 2024 — McMap. All rights reserved.