Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Haskell: Variables

A Variable is a named memory location used to store a value. Variables and function names must always start with lower case letter.

p = 100000
t = 1.10
r = 5

interest = p * t * r *0.01

In above program, I defined four variables p, t, r and interest. All these variables store a number.

Prelude> :load interest.hs
[1 of 1] Compiling Main ( interest.hs, interpreted )
Ok, modules loaded: Main.
*Main> p
*Main> t
*Main> r
*Main> interest
*Main> 10*p
*Main> 10-p

Variables in Haskell are immutable, that means you can’t change the value of a variable after its definition.

var1 = 10
var1 = 13.24

This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Haskell: Variables


Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription