Objectifs

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

Syntaxe

while cond 

{

  instruction 1;

  instruction 2;

  ...

}

Exemple: Boucle while en mode for

int cond=1;

int i=0;

while cond % 0, 1, ..., 10

{

  instruction 1;

  instruction 2;

  ...

  i=i+1;

  if i==10

    cond=0;

}

Les erreurs à éviter

  1. Oublie des accolades {}
while cond

  instruction1; % Incluse dans la boucle 

  instruction2; % Non incluse dans la boucle

  ...;          % Non incluse dans la boucle
Click to rate this post!
[Total: 0 Average: 0]

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.