Objectifs

    1. A quoi sert les instructions break et continue ?
    2. Les syntaxex
    3. Les erreurs à éviter

Instruction break

while 1  

{

  instruction 1;

  instruction 2;

  ...

  if cond2 break; % Exit la boucle 

}

équivalent à

do  

{

  instruction 1;

  instruction 2;

  ...

}while !cond2;

Instruction continue

while 1  

{

  instruction 1;

  instruction 2;

  ...




  if cond2 continue; % Saut des instructions en aval   




  instruction 3;

  instruction 4;

  ...

}

équivalent à

while 1  

{

  if !cond2

  {

    instruction 1;

    instruction 2;

    ...

    instruction 3;

    instruction 4;

    ...

  }

  else

  {

    instruction 1;

    instruction 2;

    ...

  }

}

Les erreurs à éviter

  1. Bien choisir les conditions d’arrêt et saut de séquence
Click to rate this post!
[Total: 2 Average: 2]

2 réflexions sur “Arduino #7: les instructions break et continue (for, while, do while)”

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Retour en haut

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

FPGA | Arduino | Matlab | Cours will use the information you provide on this form to be in touch with you and to provide updates and marketing.