What is the use of break and continue?

Break Statement

Break Statement – This statement is used to “jumps out” of a loop. The break statement breaks the loop and continues executing the code after the loop (if any).

Continue Statement

Continue Statement – This statement is used to “jumps over” one iteration in the loop. The continue statement breaks one iteration (in the loop) if a specified condition occurs and continues with the next iteration in the loop.

Escape Sequences

Character ConstantMeaning
\bBackspace
\fForm feed
\nMove to new line
\rCarriage return (Enter)
\tHorizontal Tab
\vVertical Tab
\\Print back slash
\?Print question mark
\‟Print single quote
\”Print double quote
\0Null character
Tagged : / / /

What is the IF statement And Switch Statement in JavaScript?

If Statement

It is used to execute an instruction or block of instructions only if a condition is fulfilled.

Syntax: –

if (condition)
      {
           block of statements;
      }

If statement with logical operator

if ( (condition1) && (condition2) )
     {
        block of statements;
     }

If else Statement

if… else statement is used when a different sequence of instructions is to be executed depending
on the logical value(True/False) of the condition evaluated.

Syntax: –

if(condition)
   {
     Statement_1_Block;
   }
else
   {
     Statement_2_Block;
   }
   Statement_3;

Else If Statement

To show a multi-way decision based on several conditions, we use else if statement.

Syntax: –

If(condition_1)
   {
     statements_1_Block;
   }
else if(condition_2)
   {
     statement_2_Blocks;
   }
else if(condition_n)
   {
     Statements_n_Block;
   }
else
 statements_x;

Switch Statement

Check several possible constant values for an expression.

Syntax: –

switch(expression){
      case expression 1:
            block of statements 1;
            break;
      case expression2;:
            block of statements 2;
            break;
            .
            .
      default:
            default block of instructions;
      }

All the cases will be evaluated if you don’t use a break statement.

switch(expression){
            case expression 1:
                 block of statements 1;
                 break;
            case expression 2:
            case expression 3:
                 block of statements 2;
                 break;
            default:
                 default block of instructions;
            }

Tagged : / / /

Tutorials for PHP Conditioning

What is PHP Conditioning?

PHP, like other programming languages, allows you to build code that executes multiple behaviors based on the results of logical or equivalent testing conditions. This presupposes that test conditions may be written in terms of expressions that evaluate true or false, and that actions can be carried out based on the results.

PHP allows programmers to assess numerous situations and determine whether they are true or false during the programming process.

A conditional statement is a programming structure that conveys these circumstances and their associated behavior.

What are the types of conditional statements?

If the test condition is not used, PHP is used. There are several ways to use a sentence in PHP.

  • The if statement
  • The if…else statement
  • The if…elseif….else statement
  • The switch…case statement
Conditional Statementfinal PHP 02
Tagged : / / / / / / / /