answersLogoWhite

0


Best Answer

it depend on the programming language u use. for instance in c, just decalre the variable and equal it to the value it is to take. eg. my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ //for php $my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ for strings (in php)eg. $my_age="none of ur business" /*$my_age is the variable and the string "none of ur business" is the assigned value*/

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 14y ago
The format is [access types] [variable type] [variable name] = [value]
For example:

int i = 10; // Here there is no access type
private static String str = "Hello, World!"; // Private and static access types.
This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 10y ago

That depends on the programming language. Usually the equal sign is used. For example, in Java:

x = 5;

Some languages use a different symbol; for example in Pascal:

x := 5

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you give values to variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

To evaluate a variable you must values for the variable and then calculate the result?

No. To evaluate a variable, you simply take its value. When you assign a value to a variable, the evaluation of that operation is the value of the variable after assignment. There is no calculation required to evaluate a variable, unless that calculation is part of the right-hand operand of an assignment operation, in which case the calculation is evaluated first and the result of that evaluation (the value) is then assigned to the variable which is then evaluated.


When do you declare a variable method and a class final?

When There is No Need to Change the Values of the Variables In Entire lifetime of That variables then we must use that Variable as Final Variable.


How many values can a boolean variable have?

Two, True or False.


How many values can store a variable at a time?

The number of values a variable can store at a time depends on the data type of the variable. For example, a variable of type int (integer) in many programming languages can store a single integer value at a time. Similarly, a variable of type float (floating-point number) can store a single floating-point value. Other data types like arrays or lists can store multiple values at a time. The capacity of a variable to store values is determined by its data type and memory allocation.


What is the difference between an array shift and unsetting a variable in PHP?

By shifting the values in an array, you are moving a key's value to the previous key. The very first key's value is obliterated. By shifting all values in the array, all keys will have a value of NULL. Unsetting a variable is entirely different -- performing a variable unsetting causes the variable to have a value of NULL, as if it was never set.

Related questions

To evaluate a variable expression you must do what to values for the variable?

You must substitute values for the variable.


What is a variable in C language?

variable which is used to specify the values and also we can that values through the variable name


If a variable has possible values -2 6 and 17 then this variable is?

If a variable has possible values -2 6 and 17 then this variable is an Integer.


What are values of the independent variable?

The answer depends on whether or not you (or someone else) have any control over it. If someone has control then they can choose the values. If not, you get what the observations give you.


What are the values of the idependent variable and the dependent variable?

the independent variable is usually assigned to x the dependent variable is usually assigned to y their values will vary because they are variables. that is the definition of variable


What is an experimental variable?

A variable whose values are independent of changes in the values of other variables. The factor you are testing.


What is the relationship between the dependent and independat variables?

The dependent variable is influenced by changes in the independent variable. The dependent variable's values depend on the values of the independent variable. This relationship is often explored through statistical analysis in research studies.


One of the values of a variable which divides the distribution of the variable?

A quantile.


What was the experimental variable?

A variable whose values are independent of changes in the values of other variables. The factor you are testing. answer by: Ayezza


What describes a variable?

A variable is a measurement that can take different "values". I put values in quotation marks because a variable can take qualitative values (for example, colour of eye) as well as quantitative (numerical) ones.


What is probability mass function?

It is a function which is usually used with continuous distributions, to give the probability associated with different values of the variable.


How can you tell if a table of values represents a function?

If all the values of the "independent" variable (x) are different then it is a function.If there are any repeats of the independent variable, the corresponding dependent variable, y, must be the same.If all the values of the "independent" variable (x) are different then it is a function.If there are any repeats of the independent variable, the corresponding dependent variable, y, must be the same.If all the values of the "independent" variable (x) are different then it is a function.If there are any repeats of the independent variable, the corresponding dependent variable, y, must be the same.If all the values of the "independent" variable (x) are different then it is a function.If there are any repeats of the independent variable, the corresponding dependent variable, y, must be the same.