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
-
3
votes2
answers103
viewsHow to create a vector2 in C?
I wonder if there’s a way I could create a class, to store 2 variables, for example, a Vector2, where I would instantiate and use it like this: Vector2 tile; int posX, posY; posX = tile.x; posY =…
-
3
votes1
answer1217
viewsTransfer keys and values from a JSON to PHP variables
How to transfer data from a JSON:…
-
3
votes2
answers10109
viewsSet Value Local SQL Server Variable
I would like to assign the value of the local variable within the SELECT, as in the example below, but displays the following error message: "A SELECT statement that assigns a value to a variable…
-
3
votes2
answers120
viewsReset variable
Is there any way to reset the variable without assigning all values again? ex: int number = 5 + rand() % 5 + 1; cout << number << endl; cout << number << endl; If the…
-
3
votes1
answer415
viewsHow to get 4 last numbers from a variable?
I have to get last numbers from a variable and I don’t know how to do it. I’m taking the milliseconds and I need to play in this variable lol, where I need you to return only the last 4 digits of…
-
3
votes2
answers117
viewsUse multiple names with distinct functions in a variable
See these variable statements: var level = 0; var atual_sequence = 0; I could put them together like this?: var level, atual_sequence = 0; One would affect the functionality of the other?…
-
3
votes2
answers298
viewsHow to generate incremented variables with Javascript?
I would like to know how to generate incremental variables, for example: var camada = 0 for (i=0; i=20;i++){ var "camada" + i + 1 = 12 } I know the code is not correct, but I wrote to better…
-
3
votes2
answers111
viewsAuto Publication Wordpress c#
I want a C# application to post on a Wordpress blog. The post title would be the variable value title and the article would be the variable html. How do I get that? Note: Console project.…
-
3
votes3
answers933
viewsHow to remove the last character, store the result in a variable and use the variable outside of foreach?
I have a code PHP thus: foreach ($rows as $obj) : $all_ids = $obj->ID . ', '; endforeach; .. whose exit is 125, 148, 157, 169, 185, How to remove the last comma and store the rest of the output…
-
3
votes2
answers198
viewsCan I access a variable (not array) in PHP using index 0 as if it were an array?
The case is this, I have a function that if something happens it creates a array with n numbers ($x[n]) and if another happens it stores in a common variable with the same name ($x). I know I can…
-
3
votes2
answers332
viewsWhat is the behavior of the reference variable and the primitive variable?
What is the behavior of a variable of reference type (null) and primitive type (0) in memory before they are initialized. Where they are in memory?
-
3
votes3
answers766
viewsHow to convert a String to Tnotifyevent in Delphi?
I want to change the Ontimer event from a Ttimer in my project at runtime, I tried as follows: Timer1.OnTimer:= ('close'); But Delphi reports this: (E2010 Incompatible types: 'TNotifyEvent' and…
-
3
votes1
answer124
viewsDeclare variables at or near the top of where they are used?
Is it better to declare all the variables right at the beginning of the file, even if they only come to be used, I don’t know, a thousand lines later? Or better go declaring as the program evolves?…
-
3
votes2
answers5642
viewsHow to access variables present in different functions?
What is the best way to access a variable that was created in a function? For example: def Luggage(): mala = [] take = raw_input("O que você deseja levar na sua viagem?") mala.append(take) In case I…
-
3
votes3
answers940
viewsCompare the same variable in PHP
I have the same variable where it can assume two values <?php if($adm1){ $email = '[email protected]'; }elseif( $adm1){ $email = '[email protected]'; } How to compare the two variables as follows,…
-
3
votes3
answers397
viewsHow to reverse date
I’m trying to invert a date variable that displays the results like this: 2016/05/20 But I want a php function that displays like this: 20/05/2016 How to do this?…
-
3
votes2
answers409
viewsPass-by Object Reference Wrapper to Method
I have been researching about passing by reference in Java and realized that it is not possible to perform this procedure directly. As only object references and array’s can be passed by reference I…
-
3
votes1
answer118
viewsA variable without assigning value accesses the variable value in another function
I have a Programming Language activity to do, whose code is done in the C language, and in this question, the question is: What will be the return of this code and why? I didn’t understand why one…
-
3
votes2
answers2055
views -
3
votes3
answers73
viewsField inside a variable dynamically?
Follow the code below: Javascript: var img1 = false; var img2 = true; var img = "img"+1; //Resultado da variavel img é "img1". //Como converter string para variável ? //Exemplo: "img1" para img1 if…
-
3
votes1
answer3038
viewsCreate angular variable in html
Hello! I have a loop (ng-repeat) in my html file and would like to save its index in a variable to be able to pass parameter to a function. Does anyone have an idea how I can do that? Follow the…
-
3
votes1
answer701
viewsWhat are C++ pointers really used for?
Where pointers are actually used? I’ve searched so many places and the example is always theoretical. I would like to know a real situation, an example within a real project in which pointers are…
-
3
votes1
answer42
viewsPass error variables between two php files
Hello I am trying to validate a form in different files, but I cannot pass the error messages between them. In index php. I have the form code : <!DOCTYPE html> <html> <head>…
-
3
votes1
answer370
views -
3
votes4
answers857
viewsCompare if variable is number within an if
Having var chute = Math.round(parseInt(prompt("Adivinhe em qual número estou pensando"))); var numeroPensado = Math.round(Math.random() * 100); if(chute != numeroPensado){ document.write("Que pena,…
-
3
votes2
answers312
viewsReplace list() by placing value in each index of an array
So I was browsing php.net when I came across List() and went to see what it was for. Then they gave me the following example: $info = array('Café', 'marrom', 'cafeína'); list($bebida, $cor,…
-
3
votes1
answer82
viewsHow to insert a variable into an array?
I want to enter data in my database I’m using mysqli, I need to know how to indicate inside an array a variable, here and my code I want to know if this is the correct way to do it require…
-
3
votes1
answer852
viewsWhy is the variable 'data' not defined?
Code: arquivo = open("surfing_data.csv") id_de_verificação = int(input("Insira a ID do surfista desejado: ")) def pesquisa_de_surfista(pesquisa): dados = {} for linha in arquivo: (ID, nome, pais,…
-
3
votes2
answers211
viewsWhat value is verified in a condition operation with value assignment to a variable?
I have a method that does a check and return of this method stored in a type variable bool. When I perform this operation C# tests the value of the variable or the return value of the method?…
-
3
votes2
answers161
viewsWhat utility has this way of accessing variable values
<?php $Bar = "a"; $Foo = "Bar"; $World = "Foo"; $Hello = "World"; $a = "Hello"; $a; $$a; $$$a; $$$$a; $$$$$a; ?> In what sense can I take advantage of this way of accessing php variables value…
-
3
votes2
answers714
views -
3
votes1
answer569
viewsUninitialized variable used in this function?
After compiling the program, you receive 2 warnings of the same type: "Warning: 'phrase' is used uninitialized in this Function" and "Warning: 'word' is used uninitialized in this Function"…
-
3
votes2
answers447
viewsPython assignment and OO
Studying about object orientation in Python I was told that a difference of such language in the instance and assignment of a class is, when we do Darth = Pessoa ( 'Darth Vader' ) The name / surname…
-
3
votes1
answer96
viewsHow to create variables in C# in the same way as in PHP?
You can use variable variables or something similar in C# as in PHP for example? $example = "etc.."; $var = "example"; // variáveis variáveis echo $$var; // etc... echo ${$var}; // etc... If not…
-
3
votes2
answers120
viewsWhat is the difference between using variable and passing direct parameter?
I wanted to know the real difference and between $sql = 'select * from tbl_blablabla'; $result = $connect->prepare(sql); and $result = $connect->prepare('select * from tbl_blabla'); Not just…
-
3
votes2
answers2309
viewsWhat is the isset equivalent of PHP in Python
In PHP, if I want to know if a variable has been started, I use isset. How can I do the same in Python?
-
3
votes1
answer80
viewsConditional Assignment in PHP
I’m studying PHP and came across a Feature which does not exist in Python (I do not know in other languages), which is the assignment in a conditional test: $file = fopen("arquivo.txt", "w");…
-
3
votes2
answers88
viewsCan you create variables within a block and use them later?
do local a2 = 2*a local d = sqrt(b^2 - 4*a*c) x1 = (-b + d)/a2 x2 = (-b - d)/a2 end -- scope of `a2' and `d' ends here print(x1, x2) …
-
3
votes1
answer425
viewsHow does Python handle static and dynamic variables?
Static variable, is the one where we separate the memory of the computer already defined beforehand (I read this in the book "Basic data structure"). The dynamic variable, on the other hand, is one…
-
3
votes1
answer49
viewsDo instances of the same application share static objects?
I am developing a Windows Form application in C#, and this application can run simultaneously several times on the same computer. And I am doubtful whether or not I should use static objects…
-
3
votes1
answer233
viewsRecover value from PATH environment variable on Linux using Java
I did not find a good topic on this subject and decided to create this question for those who are going through this problem. By using System.getenv("PATH") not listed all values of this environment…
-
3
votes3
answers559
viewsHow to know the type of a variable in Kotlin?
What is the function to know the type of a variable? ex: var a = "teste" print(a.type()) output: String
-
3
votes1
answer71
viewsRead something after a C#keyword
I have the following situation, I have a document(txt) that has some things 'filled' type: Nome:"João"; Idade:"20"; Estado:"SC"; The result I wanted is that the variables had only what is written…
-
3
votes2
answers105
viewsHow to change the value of several variables of the same type, for the same value, at once?
I was wondering if there’s any way to change several variables of the type bool for the same value, true or false, all at once? I have several methods that are similar and do the same thing, only…
-
3
votes1
answer137
viewsWhat is the difference between export, set and edit . bash_profile?
I currently use three ways to define environment variables on linux or Mac, because I don’t know what the difference is between 3, someone can explain to me?
-
3
votes2
answers106
viewsHow do I get a variable in another method?
I declared a variable within the class Main and I want to use it within a method, as I put it there? public class Main { static Scanner entrada = new Scanner(System.in); Aluno aluno = new Aluno();…
-
3
votes2
answers165
viewsVariable appears as undeclared when trying to use it in the "while" loop
When trying to create a program that converts Celsius into Fahrenheit to get practical and I come across the following error message: Erro "sair " undeclared (first use in this function) My…
-
3
votes3
answers146
viewsPrint more variable text
A doubt, as I print (print) a variable x after a text in R. As in the python you do. print (f"seu numero é",x)
-
3
votes2
answers144
viewsWhat are the differences between constants declared with const and immutable variables declared with Let in Rust?
The declaration of immutable variables In Rust if you want to declare a variable, we use the keyword let. Example: fn main() { let site_name = "Stack Overflow em Português";…
-
2
votes1
answer1517
viewsPassing variable to modal
I have a modal that opens at the end of an action (Example: Disable User). I am building the modal and wanted it to receive the text present in an ajax variable. Check code: $.ajax({ url:…