Questions tagged [control-structure]

Within an imperative programming language, a control flow statement is a statement whose execution results in a choice being made as to which of two or more paths should be followed.

Within an imperative programming language, a control flow statement is a statement whose execution results in a choice being made as to which of two or more paths should be followed.

The kinds of control flow statements supported by different languages vary, but can be categorized by their effect:

  • continuation at a different statement (unconditional branch or jump),
  • executing a set of statements only if some condition is met (choice - i.e., conditional branch),
  • executing a set of statements zero or more times, until some condition is met (i.e., loop the same as conditional branch),
  • executing a set of distant statements, after which the flow of control usually returns (subroutines, coroutines, and continuations),
  • stopping the program, preventing any further execution (unconditional halt).

from Wikipedia

138 questions
-5
votes
2 answers

How could I rewrite this selection structure with only if statements?

A problem I have asks to create a program, where a user is to enter an integer value (between 1 and 4) and depending on the input, a specific output is to be generated. It must also provide an error to the user when the value entered is not between…
-5
votes
5 answers

Accessing index when iterating over java array for loop

This is perhaps a random and nitpicky question, but I've been doing a lot of work with array manipulation in Java recently, and I was wondering whether, when using the following loop: for (Object obj : SomeArrayOrCollection) { //do…
nameless912
  • 367
  • 1
  • 12
-6
votes
3 answers

How to - Go Dynamic with PHP

I have a form which actions against a php file. Once the form is completed and the data is inserted into the databse, it want it to display "Awesome". Awesome is being displayed but is above the form. I want it to replace the form and display…
Johnson
  • 17
  • 1
  • 1
  • 8
1 2 3
9
10