Inicializar unha variable en Gambas
febrero 18, 2021Aínda que non hai obriga de inicializar as variables, é recomendable por que o espacio que reserva a RAM
para conter a variable, pode ter xa un dato. E se isto sucede, podes ter algún problemiña.
As variables inicialízanse dándolles un valor así:
Miña_Variable=5
—– Miña_Variable colle un valor de 5
Miña_Variable=”
Ola mundo!”
—– Miña_Variable colle como valor o texto “Ola mundo!”
As variables globais inicialízanse ao arrancar o programa deste xeito:
Nome_do_modulo.
Nome_da_variable=
Valor
Unha variable dun tipo de datos, só pode conter ese tipo de datos.