• [^] # Re: Qtisation

    Posté par . En réponse à la dépêche Ubuntu 13.04 Raring Ringtail. Évalué à 8.

    Ben non, pas complètement.


    argent = 100
    import random
    if random.choice([False, True]):
     agent -= 23
    print(argent)
    
    

    $ python test.py 
    100
    $ python test.py
    Traceback (most recent call last):
     File "test.py", line 5, in <module>
     agent -= 23
    NameError: name 'agent' is not defined
    
    

    Perl, si :

    use strict;
    use warnings;
    my $argent = 100;
    if (0) { # perl va râler alors qu’on ne va jamais dans ce bloc
     $agent -= 23;
    }
    print $argent, "\n";
    
    

    $ perl test.pl 
    Global symbol "$agent" requires explicit package name at test.pl line 7.
    Execution of test.pl aborted due to compilation errors.
    
    

    Bon, ensuite, d’autres compilateurs font des messages d’erreur encore meilleurs.

    Rust :

    test.rs:10:2: 10:7 error: unresolved name: `agent`. Did you mean: `argent`?
    test.rs:10 agent = 77;
     ^~~~~
    error: aborting due to previous error
    
    

    Clang :

    test.c:10:3: error: use of undeclared identifier 'agent'; did you mean 'argent'?
     agent -= 23;
     ^~~~~
     argent
    test.c:6:6: note: 'argent' declared here
     int argent = 100;
     ^
    1 error generated.