Most voted "flow-control" questions
Within an imperative programming language, a control flow demonstration is a statement whose execution results in a choice to be made as to which of the two or more paths should be followed.
Learn more…18 questions
Sort by count of
-
34
votes4
answers2538
viewsShould exceptions be used for flow control?
When I studied Java, I learned that exceptions should only be used in situations, well, "exceptional" (i.e. an error, an unforeseen condition, etc), never for normal flow control. Not only because…
-
31
votes1
answer29273
viewsWhat’s the difference between break, pass and continue in Python?
The Python documentation in Portuguese is a work in progress, and reasonably confusing as you can see. I have difficulties in English and I found that website that I can’t read. So how can I use…
-
24
votes1
answer933
viewsWhy is the use of "break" considered bad?
In many places I have heard several comments about this, such as: "Professional programmer does not use break" "The code sucks when you see a break" Because the use of break is so frowned upon by…
-
15
votes2
answers2880
viewsWhat is cyclomatic complexity?
Regarding the complexity of algorithms, I observed that there are several citations about cyclomatic complexity. What is cyclomatic complexity? In which situation is it important to analyze this…
-
12
votes4
answers299
viewsWhat does the "do" function do in Javascript?
I searched a lot and I can’t find the functionality of do in Javascript. Example: function b(a, b) { do a = a[b]; while (a && 1 !== a.nodeType); return a }…
-
7
votes2
answers2508
viewsDifference between commands to stop execution
I found that there are several ways to interrupt an execution. Basically what is the difference between using the commands: break; sys.Exit() ( From the module sys); os. _Exit() ( From the module…
-
4
votes2
answers360
viewsPut method return before a "Finally" block
Considering: try { System.out.println("Parte 1"); return false; } finally { System.out.println("Parte 2"); } What will be the output and what happens behind the scenes so that the output come out…
-
4
votes4
answers837
viewsProblems with conditional structures
I started programming a little while ago and I’m doing some Python exercises. The problem is that the result variable always returns "Approved" even when the concept is "D" or "E". I’ve broken my…
-
2
votes1
answer396
viewsLogic error in PHP when constructing if elseif Else
I have a simple email form with reCaptcha. To avoid the user sending the email and keep giving F5 and sending the same email several times, I did a redirect in a php script. But there is a logic…
-
2
votes2
answers3402
viewsError: Not all code paths return a value
Follow the error: "Logincliente(string, string)":not all source paths return a value class Conta { #region atributos public String nomeCliente { get; set; } public String numAgencia { get; set; }…
-
1
votes1
answer427
viewsAssociate commit to Bitbucket Issues
With Bitbucket it is possible to work with "Issues", in which case it could be used as "tasks/bugs/etc...". My question would be whether it is possible to associate one or more commits to a…
git commit versioning bitbucket flow-controlasked 9 years, 7 months ago Anderson Brunel Modolon 1,111 -
1
votes1
answer236
viewsConditionals and Control Flow (Codecademy Python 9/15)
Hello, I’m performing an exercise of Codecademy and I have to solve the following conditions: Match bool_one to False or not True and True result Match bool_two to False and not True or True result…
-
1
votes1
answer72
viewsHow to check if the function would generate an Exit in C++
I have a .lib with some functions. I defined that when the calculation of some function generates values outside the range allowed it to exit(). Now my C++ code that uses this lib need to calculate…
-
1
votes1
answer123
viewsDifference between algorithms that read numbers until receiving the number 999
What is the difference of these codes? First code: cont = 0 n = 0 total = 0 n = int(input("Digite 999 para parar")) while n != 999: n = int(input("Digite 999 para parar")) cont += 1 total += n…
-
1
votes2
answers77
viewsDoubt about switch
I would like the switch show me the sum if I choose case 1 as follows the code, but it does not perform the operations. #include<stdio.h> int main() { int a,b; int operacao; int soma = a + b;…
-
1
votes2
answers1085
viewsReturn to previous menu
I’m trying to add a "Back" from one menu to the other, first tried using the do only in the 2nd. menu to return to the first, but it only closes. Follow the whole code: namespace ConsoleApp10 {…
-
0
votes2
answers277
viewsDisplay the first 5 divisional numbers by 3, discarding the number 0
I’m not able to display the first 5 divisibles by 3, I put a counter variable, but it returns another number. #include <stdio.h> #include <stdlib.h> int main() { int n = 20; for(int i=1;…
-
-1
votes1
answer865
viewsConversion from flowchart to code
I am trying to convert a sizable size flowchart to Arduino code. The flowchart is as follows:: Considering your size, I’d feel more comfortable using the remote goto as a flow control. However I…