Most voted "variables" questions
A variable is a named data storage location in memory. Using variables , a computer program can store text numbers, binary data, or a combination of any of these data types. They can be transferred in code, to other functions and even other applications.
Learn more…645 questions
Sort by count of
-
-1
votes3
answers208
viewsHow to format decimals in Javascript?
Guys, with the following code here, I wanted to know how to round the decimal places of the floating values: from now on I thank those who can help :) num1 = parseFloat (prompt ("digite o primeiro…
-
-1
votes1
answer243
viewsNameerror: name is not defined for initialized vector, how to tidy?
I’m making a program to calculate a certain time, with a probability of something happening and going wrong, but I’m getting Nameerror: name 'tempo_ida' is not defined variable h is defined as 0.…
-
-1
votes1
answer202
viewsHow to declare an array variable as global in PHP securely?
In the function below I receive a message that the form used is not safe... and even ignoring I am unable to collect the contents of the variable $a after function $a = array(); function teste1(){…
-
-1
votes1
answer43
viewsSet a runtime variable from a string and a python object
I want to add a variable to my code or in memory at runtime, I’m looking for something like this since yesterday and can’t get the desired result. Let’s say I have an object: (<bound method…
-
-1
votes1
answer117
viewsJavascript - Variable gets Undefined after a function
I have two classes. One that contains the function and the other that matters that function. For some reason I could not figure out the value of the variable after the function is Undefined. First…
-
-1
votes2
answers260
viewsTaking a TD value from an HTML table to feed a PHP variable
I’m developing a web system. In this system I have tables with many columns since they are a lot of information, to reduce this I selected the most important information to be displayed and put in…
-
-1
votes1
answer61
viewsHow to find a variable from another function in the function’s IF?
Good morning, This program that I am practicing, already has other answers, however I decided to increase in another way. The program asks to request the value of the working hour and the amount…
-
-1
votes1
answer131
viewsError: Try correcting the name to one that is defined, or Defining the name
I am doing a small project using Dart, only that there is an error in my file ImprimirResultado.dart. Error Undefined name 'Imcformated'. Try correcting the name to one that is defined, or Defining…
-
-1
votes1
answer158
viewsIndefinite array key
Community greetings, I’m starting in php and came across a problem that I believe is about variable scope. The project is to show the prime divisors of a number (saved in the "divisors" array) and…
-
-1
votes2
answers73
viewsThe code below is not running. Only when I remove the variables Width and Height from within the functions
Is it possible for someone to answer this question? It should be simple, but it’s breaking my head. The code below is not running. Only when I remove the variables Width and Height from within the…
-
-1
votes1
answer23
viewsValueless results on variables, values added in Testemain class are not being used in Calculator class methods
public class Calculadora { public float valor1; public float valor2; public float valor3; public Calculadora(float valor1) { } public Calculadora(float valor1, float valor2){ } public…
-
-1
votes0
answers22
viewslocal variable is not being changed? python jupyter
I have a var local that for some reason is not being zeroed print(pf,qcx) <------ essa linha é executada qcx = 0 <------ essa não i do not know debuggar in jupyter and do not understand why…
-
-2
votes2
answers793
viewsHow to place variables in email with phpmailer?
$sql = ("SELECT nome, datas FROM tabelas WHERE datediff(now(), data) <= 10 "); $validade = mysql_query($sql); while.... (codigo phpmailer) // corpo da mensagem $PHPMailer->Body =…
-
-2
votes1
answer93
viewsCall Variable for php file name
I have a problem calling the variable name to the Excel file name. I have to put Variavel’s name on the file. The variable name comes from Select * ... //--- Fazendo o preenchimento inicial…
-
-2
votes1
answer98
viewsHow to insert an instruction into the array only if it is true?
I need to somehow verify if there is any element within a given array and if there is, put a whole string in a specific place. For example: I need to check whether $categoria is not empty $categoria…
-
-2
votes1
answer154
viewsChart primefaces does not take Selectonemenu variable
I am trying to pass a Selectonemenu variable to a Chart of the first faces and I believe the program updates the Chart before passing the variable. <p:outputLabel for="listagem"…
-
-2
votes2
answers59
viewsMerge variables and include 0 to an 11 digit php field
I’m generating a bar code,: Number of the shop: $v_ficha_loja = $row['ficha_loja']; = (1)or (2)etc.. Number of the environment: $v_ficha_ambiente = $row['ficha_ambiente']; (1)or (2)etc.. And a…
-
-2
votes1
answer115
viewsAdding an external variable to the php class
Hello folks I am creating a class for user data and would like to know how to insert a sternal variable containing data, for example from the database: class Usuario { public $nomecompleto; }…
-
-2
votes3
answers425
viewsReplace Space by Comma
$var = 123 456 789; I need the value of this variable to stay: $var = 123,456,789; Or add a comma after the number: $var = 123, 456, 789; I tried so: str_replace($var," ","")…
-
-2
votes3
answers99
viewsIf I declare a variable and do not use it in the body of the program, will it compile?
I have a program and left a declared variable, but I did not use in the body of the program.
-
-2
votes2
answers39
viewsFunction error when used on another page
I have the following code class Auth { function getMemberByUsername($username) { $db_handle = new DBController(); $query = "Select * from members where member_name = ?"; $result =…
-
-2
votes2
answers1436
viewsTake variable value in another method
Inside the same file I have 2 methods: public IActionResult OnGet(){ CarregarMenu(); //Gostaria de pegar aqui o valor da variável lcMenuPrincipal Return Page(); } And the other: public static void…
-
-2
votes2
answers81
viewsConcatenate string of variables
I have a problem, I need to concatenate some variables here in PHP and they are strings, but the problem is that they are inside "ifs" so when it is not set, it says that the variable is Undefined…
-
-2
votes2
answers581
viewsHow to pass python variable to sql query?
I am using Mysql as a database. I wanted to be able to pass the value of a python variable as a parameter in this query. Ex: cursor = connection.cursor() variavel_nome_cliente = input('Digite aqui o…
-
-2
votes1
answer28
viewsError in data editing page
good night! I have a page for editing the user data that is logged in at that time in the account, however, I am receiving an error message from the page: Here is the php code of the page: <?php…
-
-2
votes1
answer94
viewsA program that sums up n numbers where the odd numbers will be disregarded, where it works as it should
#include <stdio.h> int main() { int i, nmrs, n, soma = 0; printf("De quantos numeros quer fazer a soma? (impares serao desconsiderados)\n"); scanf("%d", &nmrs); for (i = 1; i <= nmrs;…
-
-2
votes2
answers25
viewsC# popular a combo box with variable double
That make a combo box with various height values but my code does not run, the result only adds 1.47: for(double i = 1.47; i <= 2.00; i++) { cbxExemplo.Itens.Add(i); }…
-
-2
votes1
answer38
viewsHow to change the value of a variable that is within a function through another function?
I have seen similar questions here in the OS, but I still can not solve the following situation, where I have the function below that is inside an external script: function updateScript(marcador, a,…
-
-2
votes2
answers139
viewsWhat’s wrong with my code?
I wanted to create a system that asked the nationality of the user and if he answered "Brasileiro", the if would lead to a response. Should any other nationality, the else would take you to another,…
-
-2
votes4
answers142
viewsVariable value changes in main function
When I declare a function and put the parameter to receive a variable of the integer type, for example, within the main function when I declare the function int param(int x); and then I call the…
-
-2
votes1
answer43
viewsHow to make a Function, replace the value of a variable in JS?
Hello! I am developing a little game in Java Script, but I am with a difficulty in the moment that the player buys a coins bonus, it will replace a value in another function, for when it is…
-
-2
votes1
answer54
viewsHow to pass the value of Sg. Input to a variable in another part of the code?
I’m doing a program to present in the college project, but I’m doing it through the window method by pySimpleGUI, I wanted when the person typed in Sg. Input a quantity, that quantity was calculated…
-
-2
votes1
answer55
viewsBecause the variables are declared empty and then receive some value?
I was watching 1 video of a calculator project in javascript, and I saw that prof first declared a global variable with no value, and through a click function, passed a value to the variable instead…
-
-2
votes1
answer40
viewsfailed . append attribute when entering list entry - (Python)
I was able to leave my registration in loop that will be terminated only if the user type N or n. After closing the registration the program displays the registration lists and draw list, however,…
-
-2
votes1
answer33
viewsAdd value of a variable in a record
I created a bat to add a file content to a record value, but I can’t get the contents of the play variable in the value. This is my . BAT @echo off setlocal EnableDelayedExpansion If exist…
-
-3
votes2
answers501
viewsUndefined variable
<?php session_start(); //validação/////// coloquei o "0" acreditando acabar com esse problema, tambem tentei NULL///////// $startaction=""; $police=""; $tipo ="0"; $Nome= "0";//atribuição do…
-
-3
votes1
answer37
viewsWhen I run on html the classification always shows Undefined, but when I run on the console it brings the answer of the _class variable can anyone help me?
<script type="text/javascript"> //função que calculao IMC do paciente. function CalcImc(peso,altura){ var imc = p/(a*a); return imc; } //Entrada de dados e…
-
-3
votes1
answer101
viewsProblem with displaying text within a <textarea>
I’m making a text editing HTML5 site, in it Oce types something in the text box and selects one of the desired options, 'Uppercase, Lowercase, Bold, Italic, Fixed, Strike, Sub, Sup'. The problem…
-
-3
votes1
answer92
viewsAssign Value to a variable that the user puts C#
I am learning C# (Good at the beginning of learning) and I saw that anything that the user inserts by "Console.Readline();" is considered as a string automatically by Visual Studio, but how do I…
-
-4
votes1
answer1085
viewsWhat is the difference between class instance variables, automatic (local) and static duration variables?
What is the difference between these variable types? How to identify them? How does C# work with them?
-
-4
votes3
answers60
viewshow to return the current line using variable but return the line being used the PHP variable
For example: <?php $linha = __LINE__; echo "a linha atual é $linha <br>"; //deveria retornar "a linha atual é 4" echo "a linha atual é $linha <br>"; //deveria retornar "a linha atual…
-
-4
votes2
answers57
viewshow to last values of a variable in several different functions, in javascript,
function CalcularSoma(valor1, valor2, soma) { var valor1 = document.getElementById("formValor1").value; var valor2 = document.getElementById("formValor2").value; var soma; soma =…
-
-5
votes1
answer314
viewsI want to create a variable with the dynamic name with javascript
To illustrate better, I have one for, and I want for each time I rotate the loop, to create a variable with the NOME plus the for ex index: for(i=0;i<5;i++){ var "variavel+i" = i…
-
-6
votes1
answer150
viewsIs it possible to delay the initialization of a constant?
With delay initialization, I say initialize a constant after your declaration. For example (pseudocode): const exemplo; exemplo = 2;
variables language-independent constant initializationasked 4 years, 11 months ago NinjaTroll 1,752 -
-6
votes3
answers177
viewsHow to initialize a constant with the value of time. Now() in Golang?
I’m used to doing projects in Python where, when initializing the same I keep a variable saying when it started (to measure the execution time of the project) like this: import time started_at =…