4,475 questions
Score of 0
1 answer
95 views
Assigning a zsh array via a nameref
Using zsh 5.9:
I would like to create a function which can be called with a name as parameter, and then creates an array of this name. Usage example:
creator myarr
should create and populate the ...
Score of 1
3 answers
229 views
no match for call to '(student) (std::string&, int&, int&)'
I'm trying to create an array of class student that I initialize later:
#include <iostream>
#include <string>
using namespace std;
class student{
private:
string name;
...
Score of -4
4 answers
145 views
Why does this assignment fail but not cause an error?
In this python I expect either for x to be assigned to 1, OR for an error/exception to be raised. Instead, nothing happens. The statement is not an error but it also has no effect.
x = 0
[x][0] = 1
...
Advice
0
votes
13
replies
88
views
Scope of variables
I'm working in the WinDev programming language/environment in which the variable scope looks rather weird to me. Consider the following pseudocode
while condition
string txt
if condition2
...
Best practices
0
votes
0
replies
36
views
How can I update the value of a variable once per month during an Arena simulation run?
I am running a simulation for one full year, and I need a specific variable (for example, a defective rate percentage) to change once every month. The variable is not related to resources, arrivals, ...
Score of 2
3 answers
142 views
Bash function to output variable's name and value
Instead of writing:
echo "variable: $variable"
when debugging, I would like to do it all with a function, say:
print "$variable"
So far I have got this working:
t=https://www....
Tooling
3
votes
3
replies
148
views
In Raku, how to assign a value but only if the value is defined?
I want to assign
my $FOO = $foo if $foo.defined;
I tried
my $FOO with= $foo;
but that doesn't work. Is there a canonical way to do this?
Score of 3
1 answer
156 views
what does assignment to $null do in ($var=$null="...")
I saw in a script this kind of command:
Write-Verbose -Message ($var=$null="foo=$(<some computation>)")
<do something more with $var>
What is the point of assigning the string ...
Score of -4
2 answers
168 views
Blackhole assignment in R [duplicate]
Suppose I have the following:
df1 <- data.frame(id=c(1,2,3))
df2 <- data.frame(id=c(2,3,4))
I want to print: (1) The number of IDs in df1 but not in df2, (2) the number of IDs in df2 but not in ...
Score of 1
1 answer
170 views
In Ansible YAML, how do I pass different variables to an include_tasks to make it reusable?
I have a workflow where I download a file, do some stuff to it, upload it, and then download it again to verify that the changes took place. I want my download logic to be in a reusable YAML file that ...
Score of -4
1 answer
113 views
COBOL assignment debugging [closed]
Here is the prompt for my class assignment:
Create an interactive program for ice cream sales you must sell at least four flavors of ice cream and you must us an evaluate statement. The ice cream ...
Score of 3
2 answers
153 views
Is there any way to move a string into a variable?
I was playing around in assembly and noticed that it's possible to overwrite a string in a variable as long as the new string does not exceed the size of the original string:
MESSAGE DB 'Hello World', ...
Score of 0
1 answer
140 views
Confusion about post-decrement and assignment execution order in C [duplicate]
I'm confused about the behavior of the post-decrement (i--) and pre-decrement (--i) operators in C, especially when used in the context of array indexing and assignment. I'm trying to understand the ...
Score of 5
0 answers
170 views
Under what circumstances does the Visual Studio compiler issue warning C4706 about assignment used as a condition?
My colleague Zag found that warning C4706: assignment used as a condition is detected by MSVC with /Wall switch only for some expressions and not for others.
In the following example:
#include <...
Score of 1
1 answer
368 views
Understanding the difference between ??=, ?= and = for bitbake variables
When looking up something in the Yocto project reference manual, I sometimes encounter ??= or ?= operators. Normally, a simple = is used in recipes instead.
What's the difference between ??= and a ...