/* exemple de if.EXE: */ /* NOUVEAU dans cet exemple : */ /* les BLOCS NON OBLIGATOIRES : begin .... end_begin */ display "------------------------------------------------------------------------- " ; display " Exemple de IF " ; display "------------------------------------------------------------------------- " ; display "";display ""; display "----------------------------" ; display " Exemple de if Nomdela Variable " ; display " if x opérateur y opérateur : instructions" ; display " else : instructions" ; display " end_if " ; display "----------------------------" ; begin ** 1 if ( 19 > 12 ) then display " Cas 1: Ok 1.............................si display " ; ** 2 if ( 10 > 12 ) then display "Blue Pb ???Premier If IMBRIQUE 10 > 12 ###dans Then :??"; else display "Cas 2: OK Premier If IMBRIQUE 10 > 12 ####dans Else : CORRECT"; enter ; ** 3 if ( 10 > 11 ) then DISPLAY " CAS IMPOSSIBLE"; exit_pgm(); else display " Cas 3: OK Deuxième If IMBRIQUE 10 > 11 #### dans Else : CORRECT"; enter ; end_if; end_if; display" Ok 2............................." ; display " Ok 3............................." ; else display " else du 1er IF !!!!!!!!!!!!!!!!"; end_if; display " frapper entrée or clic right/left"; enter; ** 4 if ( 1 = 2 ) then display "Cas 4: Exemple de if Nomdela Variable Blue PB " ; exit_pgm(); display " if x opérateur y opérateur : instructions" ; display " else : instructions" ; display " end_if " ; display "----------------------------" ; end_if; enter; ** 5 if ( (11 = 9 ) OR ( 11 < 9 ) OR ( 12 = 4 ) OR ( 999 = 14 ) ) then display "Cas 5: Instruction OR If xxx then : true = 0 dans 11 = 9 ligne 2 Blue PB " ; exit_pgm(); else display " Cas 5: Instruction else : true =1 dans 11 = 9"; end_if ; enter ; ** *************************** TEST avec opérateur Not_Void (contenu != 0) *********************** ******************************avec ou sans parenthèse ****************************************** ** 6 if (10 Not_Void ) then display " Cas 6: pas vide 10 "; end_if; enter ; ** *************************** TEST avec opérateur = *********************** ************************************************************************ ** 7 if ( 10 != 9 ) then display " Cas 7: Instruction If xxx then : true = 0 dans 10 != 9 "; else display " Cas 7 : Instruction else : true =1 dans 10 = Blue PB " ; exit_pgm(); end_if ; display " frappez sur la touche Retour Chariot (ou entrée)or clic right/left pour continuer " ; enter ; ** 8 if ( 10 > 9 ) then display "Cas 8 : Instruction else : true =1 10 > 9 "; end_if ; ** 9 if ( 10 > 11 ) then display "Cas 9 : Instruction else : true =1 10 > 11 Blue PB " ; exit_pgm(); end_if ; enter ; ** 10 if ( 10 < 9 ) then display "Cas 10: Instruction If xxxxx then : true = 0 dans 10 < Blue PB " ; exit_pgm(); else display "Cas 10: Instruction else : true =1 10 < 9 "; end_if ; enter ; ** 11 if ( 10 <= 9 ) then display " Cas 11:Instruction If xxxxx then : true = 0 dans 10 <= 9BIG PB " ; exit_pgm(); else display " Cas 11:Instruction else : true =1 10 <= 9 "; end_if ; ** 12 if ( 10 => 9 ) then display "Cas 12: Instruction If xxxxx then : true = 0 dans 10 => 9 "; else display " Cas 12:Instruction else : true =1 dans 10 => 9 Blue PB " ; exit_pgm(); end_if ; enter ; ** 13 if ( 10 = 10 ) then display "Cas 13: Instruction If xxxxx then : true = 0 dans 10 = 10 "; end_if ; end_begin ; display " fin de la première phase de présentation de IF " ; display " frappez sur la touche Retour Chariot (ou entrée) pour continuer " ; enter ; ** 14 if ( 10 < 9) else display " phase 2 de l'instruction if : ELSE sans THEN dans 10 < 9 " ; end_if ; display " fin de la deuxième phase de présentation de IF " ; display " frappez sur la touche Retour Chariot (ou entrée) pour continuer " ; enter ; ** fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ** 15 if (15 > 12 ) then display" Ok 1............................." ; ** 16 if ( 10 > 12 ) then display " Premier If IMBRIQUE 10 > 12 dans Then :??Blue PB " ; exit_pgm(); else display " OK Premier If IMBRIQUE 10 > 12 dans Else : CORRECT"; enter ; ** 17 if ( 10 > 11 ) then DISPLAY " CAS IMPOSSIBLE Blue PB " ; exit_pgm(); else display " OK Deuxième If IMBRIQUE 10 > 11 dans Else : CORRECT"; enter ; end_if; end_if; display" Ok 2............................." ; display" Ok 2 1............................." ; else display " else du 1er IF"; end_if; ** 18 if (10 > 2 ) then Display " Fin de l'exemple If OKKKKKKKKKKK "; else display " Blue PB Blue PB " ; ** exit_pgm(); end_if; display""; display""; display"";