Objectifs

  1. A quoi sert la boucle do … while ?
  2. La syntaxe
  3. Les erreurs à éviter

Syntaxe

do  

{

  instruction 1;

  instruction 2;

  ...

}while cond;

Exemple 1

int cond=0;

do

{

  instruction 1;

  instruction 2;

  ...

}while cond;

Exemple 2

int indice=0;

do

{

  instruction 1;

  instruction 2;

  ...

  indice=indice+1; % 0, 1, 2, ..., 10

}while indice!=10;

Les erreurs à éviter

  1. Mauvaise définition de la condition
  2. Oublie du « ; » à la fin de la boucle
Click to rate this post!
[Total: 1 Average: 4]

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.