Jump to content

Mutable variable

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by KazMalKen (talk | contribs) at 03:28, 20 September 2019 (Added example). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In Computer programming, a mutable variable is a variable that can be changes later in the program. [1]

In rust defining a mutable variable would look like this {{{1}}}. This assigns the variable 'x' to the value of 5. If you wanted to create a immutable variable which could not later be changed, in rust you would do this. {{{1}}} this assigns the variable 'y' to be 25. In the first example, the programmer could later in the program, do {{{1}}}, and the value of 'x' which was formerly 5 will now be 125.

  1. ^ "Mutable". MDN Web Docs. Retrieved 2019-09-20.