Uploaded by damilea79

1. Introduction to Variables & Data Types

advertisement
Bien, vamos a comenzar por las variables. Las variables son como contenedores en los cuales podemos almacenar información. Por ejemplo, digamos que tenemos el valor.
Número 10. Creamos una variable, para esto necesitamos darle un nombre, digamos myNumber.
Y a continuacion colocamos este valor 10 dentro de esta variable.
De ahora en adelante, cada vez que quiera usar el dato 10, en su lugar utilizarémos la variable myNumber.
Puedes ver que lo que hemos hecho aquí, es como si etiquetáramos nuestros datos con un nombre descriptivo.
Y a partir de ahora, en nuestra programación, en nuestro código, en lugar de 10, usamos la variable, myNumber.
Pues eso es lo que son nuestras variables.
Son como contenedores que almacenan información.
Ahora que tienes una idea de lo que son las variables, hablemos de Tipos de Datos.
Los tipos de datos son un concepto muy simple pero muy importante disponible en casi todos los lenguajes de programación.
Y como su nombre indica, es el tipo de datos que queremos almacenar en nuestra variable.
Tenemos diferentes tipos de datos.
Digamos que vamos a hablar sobre el nombre de nuestro tipo de datos, luego el tipo, lo que significa cómo vamos a mostrarlo en nuestro programa y luego algunos ejemplos.
Así que vamos a comenzar por los números enteros.
Integers in code will be shown by end and examples are like numbers.
Por ejemplo, 1, por ejemplo, 5, 1000, 20000.
Estos son ejemplos de números enteros.
Luego están los números de coma flotante que se muestran como float y son números decimales, por ejemplo, 5,8 o 100,8.
Es decir, son números decimales que se representarán con el tipo float.
Tenemos los caracteres que se representan mediante la sigla char y que son un detat dentro de comillas simples.
You can see that we have the data, one which is an integer, but because it is inside single quotations, we will call this a character or for example, a is a data.
Pero como está entre comillas simples, será un carácter.
Luego tenemos las cadenas que se mostrarán mediante la palabra string en el código y que son como palabras o frases, esta vez entre comillas dobles, por ejemplo.
Hello or how are you?
They are inside those double quotations.
They could be even other data, for example, an integer like 1000.
But because it is inside double quotation, we will take it as a strange and what else we have.
We have booleans shown by Boolean in code and they have just two values.
They are either true or false.
Then at last we have our eyes, which will be shown by our writing code, and they are a data structure consisting of a collection of elements.
For example, it could be a collection of numbers, collection of strings.
And in Kosslyn we even can define arrays that our collection of mixing of all of the times.
For example, this could be a collection of integers offloads characters, so by Arizonian mean a collection of elements.
So that's about data types that we have in Kotlin.
They are other data types also in Scotland that are not very important for us to talk about in this section.
But if if somewhere in the future we need to use those later times and we'll talk about it and that they are not that much hard to understand, but we will talk about it and you will understand them all.
But for now, we are going to talk about data types, integers, floating point characters, strings, booleans and our eyes.
Now, let's see how we are going to talk about this data types in the following episodes.
We first going to create a variable of type numbers or integers and integers or even the floating point.
Our numbers, too, and we will see how we should name our variables and what is a convention in programming.
Then we will talk about variable types.
If remember in the previous section we said that we have two types of value and where which one is changeable and assignable about the other is not.
Then we talk about string and characters, booleans and atlast our eyes.
This will be the steps that we're going to talk.
About data types, variables, how to name them and how many type of variables we have.
So let's go to the next episode and start by numbers and variable naming.
Download