Variables is the base of every computer programming language. Variables is used to store, manipulate various types of information encoded in a particular format, They also work like a container which can hold any value according to their bucket holder. So in this tutorial we would going to create a react native app and Create Initialize Integer String Boolean Float Variables in React Native in React Native android iOS application. So let’s get started .
Contents in this project Create Initialize Integer String Boolean Float Variables in React Native App Code :
React Native has the same the declaration syntax as JavaScript. So using var we could declare variable and initialize value to it.
1. We would create Integer variable using var. All we have to do it assign Integer value to it. See the below example.
- A stores value 5.
- B stores value 6.
- Z stores the value of A + B which is 11.
1
2
3
4
5
|
var A = 5;
var B = 6;
var C = A + B;
// The output should be 11.
|
2. Storing String Value in var. React native variable can hold any type of value.
1
2
3
|
var first_name = “Rita”;
var last_name= ‘Sharma’;
|
3. Storing Float type value in var.
1
|
var pi = 3.14 ;
|
4. Create Boolean type of value using var.
1
|
var data = true ;
|