All Questions
Tagged with variable-assignment variables
390 questions
3
votes
1
answer
113
views
PHP variable as reference
I'm confused about the concept of variable in PHP.
As far as I know, a variable in PHP has a name ($p) and a value ('Carlo').
$p has an associated entry in symbol table, such an entry actually points ...
1
vote
2
answers
95
views
Getting the name of the variable assigned to a new variable in R [closed]
Suppose I do the following
y <- c(1,2,3)
x <- y
Now I want to know what variable was used in the assignment of x. I want it to return "y". Any idea how to do that?
0
votes
1
answer
92
views
TLE on coin combinations 1 cses
can someone tell why the following code for coin combinations 1 question from cses problemset is getting time limit exceeded
#include <bits/stdc++.h>
#define int long long
using namespace std;
...
0
votes
1
answer
34
views
Python variable assignment to avoid sharing the same memory space [duplicate]
I need some help eith the following code in Python, is an implementation of an ALNS heuristic for vrp that I'm trying to create.
def run_heuristic(num_customers, num_vehicles, num_iterations, ...
-1
votes
1
answer
68
views
dollar sign $ as an assignment operator for a value of string in vs code ( js ) does not work or highlighted [closed]
function sayHello (userName) {
console.log ('Hello ${userName}') ;
}
sayHello ('Mena') ;
function sayHello (userName) {
console.log ('Hello ${userName}') ;
}
sayHello ('mena') ;
// i ...
0
votes
1
answer
131
views
Variable assignment in an f-string [duplicate]
Question question regarding f-strings and expressions in Python 3.
The Python documentation states clearly that:
Formatted string literals (also called f-strings for short) let you
include the value ...
0
votes
1
answer
48
views
Why does my function know a value of an attribute without a assignment rule? [closed]
I've started learning Python recently and got this code here:
import math
class Circle:
def __init__(self, radius):
self.radius = radius
def area(self):
return math.pi * self....
0
votes
2
answers
74
views
PHP make variable value part of another variable name
I am trying to create a new variable out of part of another variables value. I have gone through multiple other SO threads but I am trying to figure out how to make the new variable its own instance. ...
4
votes
5
answers
303
views
Why does "setf" not work when using "let"?
The behavior of setf when combined with let is confusing to me. Here, setf isn't changing the second value of my list.
(defun to-temp-field (lst)
(let ((old-value (nth 2 lst))
(new-value '...
1
vote
2
answers
34
views
Does python multivariable assignment order mattering?
I am working on leetcode problem 206 and have come up with :
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
...
0
votes
0
answers
235
views
Unable to get variable from another job in github actions workflow using outputs
Note: if I change echo "formatdate=$date" >> $GITHUB_OUTPUT to echo "::set-output name=formatdate::$date" then it works !!. But I do not wish to go by this solution as set-...
0
votes
1
answer
83
views
Macro to create new variable based on values of other variable R
I'm trying to create a variable "Q7_1_r", whose value is based on the values of the existing variable "Q7_1", and then apply the technique to multiple variables (similar to a ...
0
votes
4
answers
129
views
one variable with multi assignments in java
double balance = loanAmount,principal,interest;
Can someone explain about this variable and multi assignments? How it is possible that "balance" can have 3 assignments (loanAmount, ...
0
votes
0
answers
261
views
Assign data returned from api to variable + javascript [duplicate]
I am working with an api in javascript to return some healthcare data to be analyzed and visualized. I created a function get_data() to access the data so it can be used elsewhere in the script:
...
0
votes
0
answers
27
views
Does setting a javascript variable with an OR work similar to an if? [duplicate]
I'm studying recursion, and I came across an example of using the Fibonacci sequence and it talked about the concept of memoization. In that, it has a variable that is declared with an OR (||). I'm a ...