Latest from Indian Defence..

Saturday, December 5, 2009

Assignment and variables

The name of a variable can be any sequence of letters, digits and underscores or their combo,but the name must not begin with a digit.

There is no limitation of length to variable names, and are case is sIGnIfiCaNt.

i.e.

octave:30> apple=10;
octave:31> ApplE=90;
octave:32> apple + ApplE
ans = 100


In Octave a variable can take many different types of values; for example, it can take a numerical (real or complex) value, it can be a vector, or a matrix, or it can be a string (that is, a sequence of symbols).

A string is always placed between quote signs "..." so that Octave will know when the string starts and when it ends. The same variable can, at different times, hold each of these values. Lets see:

octave:34> first = "second"
first = second
octave:35> first
first = second

No comments:

Post a Comment

So, ready to fumble ?? :)