Technopedia Center
PMB University Brochure
Faculty of Engineering and Computer Science
S1 Informatics S1 Information Systems S1 Information Technology S1 Computer Engineering S1 Electrical Engineering S1 Civil Engineering

faculty of Economics and Business
S1 Management S1 Accountancy

Faculty of Letters and Educational Sciences
S1 English literature S1 English language education S1 Mathematics education S1 Sports Education
  • Registerasi
  • Brosur UTI
  • Kip Scholarship Information
  • Performance
  1. Weltenzyklopädie
  2. Affectation (informatique) — Wikipédia
Affectation (informatique) — Wikipédia 👆 Click Here! Read More..
Un article de Wikipédia, l'encyclopédie libre.
Page d’aide sur l’homonymie

Pour les articles homonymes, voir Affectation et Assignation.

Cet article est une ébauche concernant l’informatique.

Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants.

En algorithmique et en programmation informatique, une affectation, aussi appelée assignation par anglicisme, est une structure qui permet d'attribuer une valeur à une variable.

Il s'agit d'une structure particulièrement courante en programmation impérative, et dispose souvent pour cette raison d'une notation courte et infixée, comme x = expr ou x := expr. Dans certains langages, le symbole est considéré comme un opérateur d'affectation, et la structure entière peut alors être utilisée comme une expression. D'autres langages considèrent une affectation comme une instruction et ne permettent pas cet usage.

Notation

[modifier | modifier le code]

La structure d'affectation est le plus souvent notée x = expr ou x := expr.

x=expr (sans espace autour du caractère =) Tous les shell unix. Par exemple {Bourne shell, Bash}
x = expr Fortran, PL/I, C (et ses descendants comme C++, Java, etc.), Python, Go (pour des variables préalablement déclarées), R, haskell, etc.
x := expr ALGOL (et ses dérivés), Simula, CPL, BCPL, Pascal[1], PL/M, Ada, Smalltalk, Eiffel[2],[3], Oberon, Dylan[4], Go[5] (initialisation et déclaration simultanées) Io, ML[6], etc.

D'autres langages utilisent une notation en forme de flèche ou un mot-clé.

x <- expr F#, OCaml, R, S
x <<- expr R
assign("x", expr) R
x ← expr APL[7], Smalltalk
x =: expr J
let x = expr Rust
LET x = expr BASIC
let x := expr XQuery
set x to expr AppleScript
set x = expr C shell
Set-Variable x (expr) Windows PowerShell
x : expr Macsyma, Maxima, Rebol

Certains langages placent l'expression à gauche de l'opérateur, et l'identificateur à droite.

MOVE expr TO x COBOL
expr → x TI-Basic, Casio Basic
expr -> x R
put expr into x LiveCode

Certains langages, comme Lisp[8],[9] ou Tcl, utilisent une notation préfixée.

(setf x expr) Lisp
(set! x expr) Scheme[10],[11],[12]
set x expr Tcl
expr x ! Forth

Notes et références

[modifier | modifier le code]
  1. ↑ (en) Lawrie Moore, Foundations of Programming with Pascal, New York, John Wiley & Sons, 1980 (ISBN 0-470-26939-1)
  2. ↑ (en) Bertrand Meyer, Eiffel the Language, Hemel Hempstead, Prentice Hall International(UK), 1992 (ISBN 0-13-247925-7)
  3. ↑ (en) Richard Wiener, An Object-Oriented Introduction to Computer Science Using Eiffel, Upper Saddle River, New Jersey, Prentice Hall, 1996 (ISBN 0-13-183872-5)
  4. ↑ (en) Neal Feinberg, Keene, Sonya E., Mathews, Robert O. et Withington, P. Tucker, Dylan Programming, Massachusetts, Addison Wesley, 1997 (ISBN 0-201-47976-1)
  5. ↑ (en) The Go langage Specification: short variable declarations
  6. ↑ (en) Jeffrey D. Ullman, Elements of ML Programming: ML97 Edition, Englewood Cliffs, New Jersey, Prentice Hall, 1998 (ISBN 0-13-790387-1)
  7. ↑ (en) Kenneth E. Iverson, A langage, John Wiley and Sons, 1962 (ISBN 0-471-43014-5, lire en ligne)
  8. ↑ (en) Paul Graham, ANSI Common Lisp, New Jersey, Prentice Hall, 1996 (ISBN 0-13-370875-6)
  9. ↑ (en) Guy L. Steele, Common Lisp: The Language, Lexington, Digital Press, 1990 (ISBN 1-55558-041-6)
  10. ↑ (en) R. Kent Dybvig, The Scheme langage: ANSI Scheme, New Jersey, Prentice Hall, 1996 (ISBN 0-13-454646-6)
  11. ↑ (en) Jerry D. Smith, Introduction to Scheme, New Jersey, Prentice Hall, 1988 (ISBN 0-13-496712-7)
  12. ↑ (en) Harold Abelson, Sussman, Gerald Jay et Sussman, Julie, Structure and Interpretation of Computer Programs, New Jersey, McGraw-Hill, 1996 (ISBN 0-07-000484-6)
v · m
Éléments de programmation informatique
Bibliothèque logicielle
  • Bibliothèque standard
  • Espace de noms
  • Framework
  • Gabarit
  • Interface
  • Interface de programmation (API)
Vocabulaire
  • Algorithme
  • Expression
  • Indentation
  • Instruction
  • Ligne de code
  • Opérateur
  • Pseudo-code
  • Ramasse-miettes
Fonctions
  • Dispatch multiple
  • Factorisation
  • Fonction imbriquée
  • Fonction de rappel
  • Fonction d'ordre supérieur
  • Fonction récursive
  • Généricité
  • Opérande
  • Paramètre
  • Polymorphisme
  • Procédure
  • Signature de type
  • Surcharge
Objet
  • Classe
  • Constructeur
  • Destructeur
  • Encapsulation
  • Héritage
  • Héritage multiple
  • Instance
  • Méthode
Événementiel Inversion de contrôle
Code source
Structures de données
  • Arbre
  • Enregistrement
  • Ensemble
  • File
  • Liste
  • Liste chaînée
  • Pile
  • Sémaphore
  • Tableau
  • Tas
  • Type abstrait
  • Vecteur
Déclarations
  • Affectation
  • Convention de nommage
  • Pointeur
  • Portée
  • Référence
  • Tableau associatif
  • Type énuméré
  • Type récursif
  • Typage statique
  • Variable
  • Variable globale
  • Variable locale
Structures de contrôle
  • Case
  • Eval
  • For
  • Goto
  • Switch
  • While
Fonctions usuelles
  • Concaténation
  • Incrémentation
  • malloc
  • printf
Outil de développement
  • Environnement de développement
  • Générateur de documentation
  • Gestion de versions
  • Modèle
  • Patch
  • Spécification
Folklore
  • Hello world
  • Principe KISS
  • Langage de programmation exotique
Catégories :
  • Programmation informatique
  • Développement logiciel
  • icône décorative Portail de la programmation informatique
Ce document provient de « https://fr.teknopedia.teknokrat.ac.id/w/index.php?title=Affectation_(informatique)&oldid=230046049 ».
Catégorie :
  • Programmation informatique
Catégories cachées :
  • Wikipédia:ébauche informatique
  • Portail:Programmation informatique/Articles liés
  • Portail:Informatique/Articles liés

  • indonesia
  • Polski
  • الرية
  • Deutsch
  • English
  • Español
  • Français
  • Italiano
  • مصر
  • Nederlands
  • 本語
  • Português
  • Sinugboanong Binisaya
  • Svenska
  • Українска
  • Tiếng Việt
  • Winaray
  • 中文
  • Русски
Sunting pranala
Pusat Layanan

UNIVERSITAS TEKNOKRAT INDONESIA | ASEAN's Best Private University
Jl. ZA. Pagar Alam No.9 -11, Labuhan Ratu, Kec. Kedaton, Kota Bandar Lampung, Lampung 35132
Phone: (0721) 702022
Email: pmb@teknokrat.ac.id