An Introduction to Programming: Variable Manipulation

0 Conversations

Variable Manipulation

Normal Variable Manipulation

String Variable Manipulation

Normal Variable Manipulation

Basic Numeric Manipulation

SymbolNameExample of Use
+AddVariable a+Variable b
-SubtractVariable a-Variable b
*MultiplyVariable a*Variable b
/DivideVariable a/Variable b
(Bracket Open
)Bracket Close
++Increment (Increase by one)Variable a++
--Decrement (Decrease by one)Variable a--

Advanced Numeric Manipulation

sqrt(Variable)Square Root
pow(Variable a,Variable b)To the Power ofVariable a to the power of Variable b

Logical Manipulation

Variable a AND Variable bAND
Variable aVariable bOutput
FALSEFALSEFALSE
FALSETRUEFALSE
TRUEFALSEFALSE
TRUETRUETRUE
Variable a OR Variable bOR
Variable aVariable bOutput
FALSEFALSEFALSE
FALSETRUETRUE
TRUEFALSETRUE
TRUETRUETRUE
NOT Variable aNOT
Variable aOutput
FALSETRUE
TRUEFALSE
Variable a XOR Variable bXOR
Variable aVariable bOutput
FALSEFALSEFALSE
FALSETRUETRUE
TRUEFALSETRUE
TRUETRUEFALSE

Precedence

1 [Done First]()
2++ --
3* / %
4+ -
5NOT
6AND
7 [Done Last]OR

String Variable Manipulation

Whole String Manipulation

UPPER(String a)Change all Characters in String a to upper case(Character Strings)
LOWER(String a)Change all Characters in String a to lower case(Character Strings)

Selective String Manipulation

substr(String a,Variable a,Variable b)A string is created from String a starting at Variable a number of characters in, and Variable b characters long.

Related Entries

Programming Entries

An Introduction to Programming: Variables

Language Specific Entries


Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A574526

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more