Questions tagged [control-flow]
Control flow (or flow of control) refers to the order in which statements are evaluated or executed.
control-flow
849
questions
0
votes
0
answers
17
views
Execute function and continue control flow with Teloxide
I want to execute some code every time a message is received by my telegram bot and always pass the control to the next branch
let handler = Update::filter_message()
.branch(
dptree::...
-1
votes
0
answers
43
views
What may I do other than printing a message to display this concept? [closed]
'''
<<<Control flow in Python>>>
A Python program to simulate a scenario of baking and eating cupcakes at a party
'''
# Class Initialization
class Cupcake:
def __init__(self, ...
0
votes
0
answers
28
views
Can you import libraries in if statements in Python? [duplicate]
I'm working on some code that grabs some data from a website and then transforms it into a data object that will work for whatever machine learning library the user is using. I wanted to do some ...
-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 ...
-2
votes
1
answer
33
views
Can you execute a block of code if a python loop is not broken [duplicate]
I'm looking for a more pythonic way to construct this check:
good_result = None
for item in items:
result = process(item)
if result.isGood():
good_result = result
break
if not ...
1
vote
2
answers
291
views
Angular new control flow @for with async pipe and aliasing variable with as
I migrated from the structural directives *ngIf and *ngFor to the new control flow with @if and @for in Angular.
But there is one case that I used previously but I cannot seem to get it to work with ...
0
votes
0
answers
31
views
Avoiding cpu/gpu synchronization due to python control flow with a constant as alternative leads to incorrect gradients
I have the following if-and-else query, which is called multiple times in my training loop:
if torch.logical_or(d0 < 1e-5, d1 < 1e-5):
h0 = torch.tensor(1e-6, dtype=dtype, device=device)
...
0
votes
0
answers
106
views
Angular 17 template code completion not working in PhpStorm 2024.1.1
I migrated project to Angular 17.3.6. Also updated PhpStorm to 2024.1.1 and there is recent Angular plugin. I cannot get IDE to provide code completion in Angular templates. Also it doesn't recognize ...
0
votes
4
answers
133
views
Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
From my previous knowledge the (logical AND) has a higher precedence than the (logical OR), so for example in the following line of Java code boolExp2 will be compared with boolExp3 before comparing ...
0
votes
0
answers
37
views
Get control flow information with JaCoCo
Looking for a way to retrieve control flow information, such as local variables and their values and which instructions/branches were executed for the tested methods using JaCoCo (0.8.11). I am ...
2
votes
1
answer
47
views
Why does a continue in this ForEach-Object loop cause Powershell to error
When piping the output of a command to a ForEach-Object loop in PowerShell, using a continue statement causes it to error out.
Works as expected:
ipconfig | ForEach-Object {
$_
}
Errors:
ipconfig |...
0
votes
1
answer
59
views
How to copy function instructions and store them in buffer? [closed]
Why isn't this code directly storing the assembly instructions of func into the buffer? The value of the buffer is junk and doesn't change.
#include <stdio.h>
#include <stdlib.h>
#...
0
votes
0
answers
282
views
Angular 17 - new control flow migration question
I performed migration with this command - ng g @angular/core:control-flow.
Now I am getting an error - Type 'unknown' must have a 'Symbol.iterator' method that returns an iterator.
This error is ...
0
votes
1
answer
323
views
how do i make a floating window that stays above programs, moveable and will accept input from another script
I am trying to build an indesign script that will produce a floating window that can display report results. I need to use this as a check-off "sheet" that will stay visible and moveable. ...
1
vote
1
answer
487
views
Angular: How to reference the result of a function in the new control flow @if with an logical AND (&&)
With the old control flow I could reference the result of a function in this way.
<span *ngIf="column.getValue && column.getValue(item) as value">{{value}}</span>
But ...