Vitaly es el Gerente de Marketing Digital en CodeMonkey. Su maestrĆa en InformĆ”tica, combinada con su experiencia como padre de dos hijos, le permite crear contenido enfocado en la formación en programación.
Understanding Variables in Coding – Explained for Kids
In the realm of programming, variables serve as fundamental building blocks. They are crucial components that store values and allow developers to manipulate data efficiently. Whether you’re a novice coder or an experienced programmer, grasping the concept of variables is essential for mastering any programming language. In this video, we’ll delve into the intricacies of variables, exploring their significance, usage, and practical applications.
Watch this CodeMonkey video to learn all about Variables in Computer Coding:
Read the transcript below:
Hello, welcome to Variable Valley! Let’s learn about variables. Variables store values. The values could be numbers, strings or even objects. Here’s a piece of code where we use a variable with the name norte, the assignment operator which is the equal sign and the value is 5.
So 5 is stored in the variable n. Later in the code, we could use that variable norte with a command such as the step command step n. Since n is 5 we’re stepping 5. So anywhere in your code where you use a number you can use a variable instead, just make sure you assign the variable of value before you use it.
Let’s look at an example.
Here’s an example where we have three variables in the code.
norte has the value of five and it looks like n is controlling how many times the loop goes around
x has the value of 5 and it looks like that’s how much we’re stepping each time
re has the value of 72 and that is the amount of degrees that we’re turning each time. And if we look at the challenge you could see the monkey is stepping and turning in order to go in a circular pattern.
Okay so let’s just go ahead and run this and what’s really cool in CodeMonkey is there’s this table here that will tell you the starting value of all the variables and if they change that change will appear there as well.
Oh it looks like we need to change the value of how far it steps. x should actually be 10 And since we change that to 10 now when we step x it’ll say what’s the value of x is 10, so you see how 10 x is 10 now.
Okay let’s look at one more example.
Now in this example you could see that the monkey is stepping in a spiral sort of pattern and first the monkey is stepping eight, turning and then stepping 12, turning, stepping 16, turning, 20, turning and 24.
How are these numbers changing each time? Yeah it’s changing by 4 each time: 8 plus 4 is 12, 12 plus 4 is 16, and so on. And you see how the code they’re giving us They have re is equal to 8 so that’s the initial distance here. And then we have a loop where we’re stepping a certain amount re And then turning left and we’re doing that over and over again. But we want this re to be four more each time so the way you code that is say d equals d plus four.
This is a really common way of coding a variable changing by a certain amount each time. So the way the code works it will evaluate what’s on the right-hand side. Say what’s the current value of re? Eight. Add four to it and then put it into the new value of re and that happens over and over again.
Also let’s just look at this code one two three four five times. I think we actually need to loop five times instead of three so let’s go ahead and run this and remember to look at the variable table to see how it changes.
See this variable table see how re is changing? Cool. I love having this this table! All right, very good. Now that we’ve reviewed variables it’s your turn to try variables!
Pam Rissmann is a middle school STEM teacher who teaches computer science, robotics, and product design. She has been teaching for 15 years, and in addition to teaching, she coaches her schoolās competitive math club and STEM Girls club. Pam is a recipient of the Santa Clara County/Texas Instruments STEM teacher award and California League of Middle School Teacher of the Year for her school. Pam was awarded by Project Lead the Way the Outstanding Gateway Teacher award in 2019.
A constant is like a super stable friend in your code that never changes. Letās dive into the world of constants and discover why they are important!
Building a K-12 computer science curriculum is no longer a visionary initiative that should be done by a few innovative districts ā it has become essential.
Usamos cookies en nuestro sitio web para brindarle la experiencia mÔs relevante recordando sus preferencias y visitas. Al hacer clic en "Aceptar", acepta el uso de TODAS las cookies. Sin embargo, puede visitar la Configuración de cookies para proporcionar un consentimiento controlado.
Las cookies necesarias son absolutamente esenciales para que el sitio web funcione correctamente. Esta categorĆa solo incluye cookies que garantizan funcionalidades bĆ”sicas y caracterĆsticas de seguridad del sitio web. Estas cookies no almacenan ninguna información personal.
Galleta
Tipo
Duración
Descripción
_codemonkey_session_rails_4
1
1 aƱo
_Georgia
persistente
2 aƱos
Esta cookie es instalada por Google Analytics. La cookie se utiliza para calcular los datos de visitantes, sesiones y campañas y realizar un seguimiento del uso del sitio para el informe de anÔlisis del sitio. Las cookies almacenan información de forma anónima y asignan un número generado aleatoriamente para identificar visitantes únicos.
cookielawinfo-checkbox-publicidad
persistente
11 meses
La cookie se establece mediante el consentimiento de cookies del RGPD para registrar el consentimiento del usuario para las cookies en la categorĆa "Publicidad".
cookielawinfo-checkbox-analytics
persistente
11 meses
Estas cookies estĆ”n establecidas por el complemento de WordPress de consentimiento de cookies de GDPR. La cookie se utiliza para recordar el consentimiento del usuario para las cookies en la categorĆa "AnĆ”lisis".
cookielawinfo-checkbox-funcional
persistente
11 meses
cookielawinfo-checkbox-required
persistente
11 meses
Esta cookie estĆ” configurada por el complemento de consentimiento de cookies de GDPR. Las cookies se utilizan para almacenar el consentimiento del usuario para las cookies en la categorĆa "Necesarias".
cookielawinfo-checkbox-no necesario
0
11 meses
Esta cookie estĆ” configurada por el complemento de consentimiento de cookies de GDPR. Las cookies se utilizan para almacenar el consentimiento del usuario para las cookies en la categorĆa "No necesarias".
cookielawinfo-checkbox-otro
persistente
11 meses
cookielawinfo-checkbox-performance
persistente
11 meses
Esta cookie se utiliza para realizar un seguimiento de las cookies que el usuario ha aprobado para este sitio.
JSESSIONID
1
1 aƱo
Utilizado por sitios escritos en JSP. Cookies de sesión de plataforma de propósito general que se utilizan para mantener el estado de los usuarios en las solicitudes de pÔgina.
view_cookie_policy
persistente
1 hora
La cookie estĆ” configurada por el complemento de consentimiento de cookies de GDPR y se utiliza para almacenar si el usuario ha dado su consentimiento o no para el uso de cookies. No almacena ningĆŗn dato personal.
XSRF-TOKEN
persistente
1 aƱo
La cookie la establece la plataforma de creación de sitios web de Wix en el sitio web de Wix. La cookie se utiliza con fines de seguridad.
Linkedin: se utiliza para rastrear a los visitantes en mĆŗltiples sitios web, con el fin de presentar anuncios relevantes segĆŗn las preferencias del visitante.
Google Analytics establece esta cookie y se utiliza para distinguir usuarios y sesiones. La cookie se crea cuando se ejecuta la biblioteca JavaScript y no existen cookies __utma. La cookie se actualiza cada vez que se envĆan datos a Google Analytics.
__utmb
persistente
30 minutos
Google Analytics establece la cookie. La cookie se utiliza para determinar nuevas sesiones / visitas. La cookie se crea cuando se ejecuta la biblioteca JavaScript y no existen cookies __utma. La cookie se actualiza cada vez que se envĆan datos a Google Analytics.
__utmc
persistente
1 aƱo
Google Analytics establece la cookie y se elimina cuando el usuario cierra el navegador. La cookie no es utilizada por ga.js. La cookie se utiliza para permitir la interoperabilidad con urchin.js, que es una versión anterior de Google Analytics y se utiliza junto con la cookie __utmb para determinar nuevas sesiones / visitas.
__utmt
persistente
10 minutos
Google Analytics establece la cookie y se utiliza para acelerar la tasa de solicitud.
Google Analytics utiliza esta cookie para comprender la interacción del usuario con el sitio web.
_gid
persistente
1 dĆa
Esta cookie es instalada por Google Analytics. La cookie se utiliza para almacenar información sobre cómo los visitantes usan un sitio web y ayuda a crear un informe analĆtico de cómo estĆ” funcionando el sitio web. Los datos recopilados, incluido el nĆŗmero de visitantes, la fuente de donde provienen y las pĆ”ginas, se muestran de forma anónima.
GPS
persistente
30 minutos
Esta cookie la establece Youtube y registra una identificación única para rastrear a los usuarios según su ubicación geogrÔfica.
SEĆOR
persistente
5 meses
Esta cookie se utiliza para medir el uso del sitio web con fines analĆticos.
MUIDB
1
1 aƱo
MicroSoft utiliza esta cookie y recopila datos sobre los usuarios que visitan varios sitios web. Estos datos se utilizan para analizar la eficacia de los anuncios en sitios web.
Utilizado por Google DoubleClick y almacena información sobre cómo el usuario utiliza el sitio web y cualquier otro anuncio antes de visitar el sitio web. Se utiliza para presentar a los usuarios anuncios que son relevantes para ellos de acuerdo con el perfil del usuario.
MUID
persistente
1 aƱo
Usado por Microsoft como identificador único. La cookie se establece mediante scripts integrados de Microsoft. El propósito de esta cookie es sincronizar la identificación en muchos dominios de Microsoft diferentes para permitir el seguimiento de usuarios.
pxrc
persistente
2 meses
El propósito de la cookie es identificar a un visitante para ofrecer publicidad relevante.
SkimResources establece esta cookie. La cookie se utiliza para registrar datos sobre el visitante con el fin de optimizar la relevancia de las ventajas que se ofrecen a los usuarios.
TapAd_DID
persistente
2 meses
La cookie la coloca tapad.com. El propósito de la cookie es rastrear a los usuarios en todos los dispositivos para permitir publicidad dirigida
TapAd_TS
persistente
2 meses
Tapad.com establece la cookie. El propósito de la cookie es rastrear a los usuarios en todos los dispositivos para permitir publicidad dirigida.
TDCPM
persistente
1 aƱo
El servicio CloudFare configura la cookie para almacenar una identificación única para identificar un dispositivo de usuarios recurrentes que luego se utiliza para publicidad dirigida.
TDID
persistente
1 aƱo
El servicio CloudFare configura la cookie para almacenar una identificación única para identificar un dispositivo de usuarios recurrentes que luego se utiliza para publicidad dirigida.
test_cookie
persistente
15 minutos
Esta cookie la establece doubleclick.net. El propósito de la cookie es determinar si el navegador de los usuarios admite cookies.
VISITOR_INFO1_LIVE
1
5 meses
Youtube establece esta cookie. Se utiliza para rastrear la información de los videos de YouTube incrustados en un sitio web.
Esta cookie estÔ configurada por linkedIn. El propósito de la cookie es habilitar las funcionalidades de LinkedIn en la pÔgina.
lang
persistente
1 aƱo
Esta cookie se utiliza para almacenar las preferencias de idioma de un usuario para ofrecer contenido en ese idioma almacenado la próxima vez que el usuario visite el sitio web.
lidc
persistente
1 dĆa
LinkedIn establece esta cookie y la utiliza para el enrutamiento.