Skip to content
Advertisement

Can anyone explain me what is state and mutable data?

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data.

http://en.wikipedia.org/wiki/Functional_programming

Can anyone explain me what is state and mutable data? Can anyone give me examples in either JAVA or JavaScript.

Advertisement

Answer

mutable suggest anything that can change, i.e. an int

JavaScript

In java a string is immutable. you cannot change the string value only its reference.

JavaScript

State is something which an instance of a class will have (an Object).

If an Object has certain values for its attributes its in a diffrent state then another Object of the same class with diffrent attribute values

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement