Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,875 members, 7,821,044 topics. Date: Wednesday, 08 May 2024 at 07:22 AM |
Nairaland Forum / Science/Technology / Programming / Variables In Programming (1465 Views)
Variables In Python / What Made You Pick Interest In Programming / Differences Between Testing And Debugging In Programming Of Software Application (2) (3) (4)
Variables In Programming by orcl200(m): 12:37pm On Mar 26, 2018 |
Variables What is a Variable? There are different ways to define variable, let see few: • Donald Knuth: - A quantity that may possess different values as a program is being executed. • Mehran Sahami: - A box in which we stuff things – i.e. a box with variable content. • Wikipedia: - User defined keyword that is linked to a value stored in computer’s memory (runtime). •A symbol or name that stands for a value. • A variable is a value that can change. • Variables provide temporary storage for information that will be needed during the lifespan of the computer program (or application). Don’t let us pay attention to how it was defined, let us just pick the key point and concept which is that “variable store value for the period of running of the program” For example: z = x + y Variables Example: • This is an example of programming expression. • x, y and z are variables. • Variables can represent numeric values, characters, character strings, or memory addresses. In a program every, variable has: – NAME (Identifier) e. g x, y and z – DATA Type (nature of data store in the variable) – SIZE – VALUE (this is the content store in the variable) Loosely Typed / Strictly Typed Languages Loosely Typed Languages: these are programming languages in which the programmer needs not to explicitly specify the type of data to be stored in the variable e.g PHP, JavaScript e.tc. If the following works: x = 10; x = "Fred"; then it's loosely typed (two different types of data in the same variable and scope). Strongly Typed Language: Languages where variables must be declared to contain a specific type of data. String myString = "Peter"; then your language is strictly typed, variable "myString" is explicitly declared to contain only string data. Then it's loosely typed . Types of Variable • there are two types of variables: – Local variable – Global variable Types of Variable • Local variables are those that are in scope within a specific part of the program (function, procedure, method, or subroutine, depending on the programming language employed). • Global variables are those that are in scope for the duration of the programs execution. They can be accessed by any part of the program, and are readwrite for all statements that access them. Rules in Naming a Variable • There a certain rules in naming variables (identifier). • They are: – It should use only alphabets, number and underscore ( _ ) – It should not begin with a number and must have at least one alphabet. – It should not be a reserved word. • Examples of reserved word: Main, log, if do continue, short, else, return, const, int, double, break, void, while, char e.t.c 1 Like
|
Re: Variables In Programming by bukiii(f): 7:35pm On Mar 26, 2018 |
Nice one.Can you write more OPP? |
Re: Variables In Programming by orcl200(m): 5:29pm On Mar 27, 2018 |
you mean OOP right? sure, watch out 1 Like |
Re: Variables In Programming by bukiii(f): 1:09am On Mar 28, 2018 |
yeah OBJECT ORIENTATION LANGUAGE.Thanks orcl200: |
Re: Variables In Programming by gangbang86: 1:13pm On Oct 28, 2019 |
what do these variables stand for? Where can we apply it? |
Re: Variables In Programming by devdev: 2:07pm On Oct 28, 2019 |
bukiii:It's called Object-Oriented Programming. |
Re: Variables In Programming by bukiii(f): 3:25pm On Oct 28, 2019 |
devdev: Thanks, I can't believe I wrote that growth � |
Re: Variables In Programming by Nobody: 5:25pm On Oct 28, 2019 |
bukiii:OOP can be challenging really 1 Like |
Re: Variables In Programming by BLUEJAYY: 5:48pm On Oct 28, 2019 |
orcl200:Encapsulation, abstraction, inheritance and polymorphism. |
Re: Variables In Programming by devdev: 7:10pm On Oct 28, 2019 |
bukiii:You are welcome. |
(1) (Reply)
Deleted / Can Someone Explain This Line Of Code To Me / I Need A Programmer To Develop This Algorithm Into App
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |