control-flow Questions

2

Solved

Is there a way to conditionally (through a script task or anything else), control the flow of program in SSIS? Currently I have a package that would create 5 different excel sheets (through Execu...
Kinna asked 21/12, 2012 at 17:59

6

Solved

I have an IEnumerable<T>. I want to do one thing for each item of the collection, except the last item, to which I want to do something else. How can I code this neatly? In Pseudocode foreac...
Tritanopia asked 24/5, 2012 at 10:32

40

Solved

Given the following code (that doesn't work): while True: # Snip: print out current state while True: ok = get_input("Is this ok? (y/n)") if ok.lower() == "y": break 2 # Thi...
Rejoin asked 10/10, 2008 at 0:2

11

Solved

I have been reading about Optionals in Swift, and I have seen examples where if let is used to check if an Optional holds a value, and in case it does – do something with the unwrapped value. Howe...
Oversubscribe asked 27/8, 2015 at 18:23

9

Solved

for the following code a =func() if a != None: b.append(a) a can be assigned to None, is there a way to avoid the if statement and only use one line of code? original problem is the following...
Sheriff asked 11/1, 2012 at 20:58

3

Solved

Suppose I have a piece of Perl code like: foreach my $x (@x) { foreach my $y (@z) { foreach my $z (@z) { if (something()) { # I want to break free! } # do stuff } # do stuff } # do stuf...
Endres asked 14/9, 2010 at 11:45

15

Solved

What sorts of methods exist for prematurely exiting an if clause? There are times when I'm writing code and want to put a break statement inside of an if clause, only to remember that those can o...
Anabolite asked 15/1, 2010 at 5:20

6

Solved

I want to check a condition inside a loop and execute a block of code when it's first met. After that, the loop might repeat but the block should be ignored. Is there a pattern for that? Of course ...
Pulverulent asked 17/7, 2013 at 13:33

6

Solved

Consider this: loop { let data = match something() { Err(err) => { warn!("An error: {}; skipped.", err); continue; }, Ok(x) => x }; let data2 = match something_else() { Er...
Romilda asked 11/4, 2018 at 22:11

4

Solved

In Jest, beforeAll() is supposed to run before beforeEach(). The problem is that when I use an async callback for beforeAll(), Jest doesn't wait for the callback to finish before going on to before...
Amin asked 14/2, 2021 at 8:58

2

create is a method that should return true only when everything went as expected and false otherwise. I'm going for error codes style control flow. class TransferOperator class TransferError <...

51

Assuming I have this pseudo-code: bool conditionA = executeStepA(); if (conditionA){ bool conditionB = executeStepB(); if (conditionB){ bool conditionC = executeStepC(); if (conditionC){ ... ...
Journal asked 26/6, 2014 at 12:25

1

Solved

We can return a value from loops with break, for example: fn main() { let mut counter = 0; let result = loop { counter += 1; if counter == 10 { break counter * 2; } }; println!("The...
Kalmia asked 10/7, 2022 at 10:45

6

Solved

Idiomatic for/else in rust: In Python, I can use for/else to check whether or not a for loop terminated at a break statement or finished 'normally': prod = 1 for i in range(1, 10): prod *= i if p...
Seawright asked 4/7, 2022 at 6:56

4

I know that there are ways to automatically generate a CFG (C ontrol F low G raph) from source code. However, from what I understand, those methods give me a visual graph - an image. I can't really...
Teledu asked 9/1, 2013 at 1:8

2

Solved

I'm trying to understand the walrus assignment operator. Classic while loop breaks when condition is reassigned to False within the loop. x = True while x: print('hello') x = False Why doesn't t...
Concentrate asked 30/12, 2020 at 22:51

8

Solved

If I’ve got a bunch of chained guard let statements, how can I diagnose which condition failed, short of breaking apart my guard let into multiple statements? Given this example: guard let keypat...
Quintet asked 6/6, 2016 at 18:23

7

I know a while loop can do anything a for loop can, but can a for loop do anything a while loop can? Please provide an example.
Pershing asked 3/10, 2009 at 17:39

6

Solved

I recently wrote this line of code: for(i in seq_len(exponent)){out<-squareMat%*%out}. Clearly, i is never used and I just wanted to say "exponent times, do out<-squareMat%*%out". W...
Thea asked 4/2, 2021 at 13:19

2

Solved

The merge and switch may not be open to use for general users. And I have searched the source code: switch merge There is a description in merge: Returns the value of an available element ...
Detrude asked 4/11, 2017 at 6:5

6

Solved

Is it possible to tell if there was an exception once you're in the finally clause? Something like: try: funky code finally: if ???: print('the funky code raised') I'm looking to make somethi...
Clavius asked 4/3, 2018 at 19:42

2

Solved

Wikipedia has a definition for a control flow graph. I've also heard terminology thrown around referring to 'call (flow?) graph', but can't find any relevant resources. What is the relationship bet...
Perspiratory asked 27/3, 2012 at 11:58

2

Solved

I don't see the reason why we use if let and just usual if. In Rust book, chapter 6.3, the sample code is below: let some_u8_value = Some(0u8); if let Some(3) = some_u8_value { println!("three");...
Quevedo asked 11/1, 2020 at 7:5

2

At some point, Intel will begin shipping CPUs that support CET(Control-flow Enforcement Technology), which adds two instructions ENDBR64 and ENDBR32. These two will be encoded as F3 0F 1E FA for...
Briard asked 13/5, 2019 at 21:40

0

I'm still hoping to receive an answer to the question(s) below. For clarity, I've added a few comments. The code below generates different segments of a circle through (Bezier)paths, which togethe...
Levitical asked 12/10, 2019 at 4:32

© 2022 - 2024 — McMap. All rights reserved.