Questions tagged [variable-assignment]

A process of setting or re-setting the value stored in the storage location(s) denoted by a variable name.

4336 questions
1
vote
1 answer

Asking multiple questions, and setting each response to a value

Currently on my first python project to make a barista trainer, the current problem I am running into is that depending on the drink/recipe I need to ask a different number of questions. I have a (I think) good way to get the questions I need, the…
1
vote
1 answer

Create an array in VBA from an array formula in Excel (From Name Manager)

I am trying to create an array in VBA from a dynamic array formula in Excel. Ideally the Excel formula would be kept in the Name Manager, but I can accept if the formula is stored in a cell. The ultimate goal is to use this array to match blocks of…
1
vote
2 answers

How to assign the length of an array to a number type variable in Angular 11?

So here is my problem, I have this going on my app.component.ts : @Component({ selector: 'sa-app', templateUrl: './app.component.html', }) export class AppComponent implements OnInit, AfterViewInit { numberEditing: number = 0; …
Amanda
  • 69
  • 8
1
vote
3 answers

In JavaScript, how can I conditionally assign value to object with destructuring and short circuit evaluation?

Let's say I have this set up: const objA = { name: "Jacob", email: "jacob@email.com" }; const objB = { lastName: "Smith" }; Why can I do this: const lastName = objA.lastName || objB.lastName; But not this? const { lastName } = objA || objB; Was…
1
vote
1 answer

How to obtain user input (as a number) to be applied to an equation

I am trying to program a scenario where a user will input two pieces of information, a 6-minute walk distance in meters at baseline (6MWDbaseline) and then a 6-minute walk distance in meters at 24-weeks (6MWD24weeks). I want the user to supply…
1
vote
3 answers

Chain assignment in Python for list

I am trying to understand chain assignment in Python. If I run x = x[1] = [1, 2], I get an infinite list [1, [...]]. But if I run x = x[1:] = [1, 2], I will get a normal list [1, 1, 2]. How does it work in the background to make these two different…
sn_2022
  • 13
  • 3
1
vote
2 answers

Why / How is my variable getting set to nil

I have some code that reads a file into an array of lines, and then parses those lines to get at the structured data. The input file has various different data types that need to be handled differently, additionally there are major sections for…
Scott
  • 674
  • 1
  • 7
  • 15
1
vote
1 answer

r-How the global assignment affect inside the function?(Especially there are 2 global assignments)

I have a question about global assignment. Here is a small example. I would like to ask why the second global assignment do not affect inside the function?And why the return output of function is different from what I call for outside the function…
1
vote
0 answers

My sub used to work for years but stopped working due to a - Run-time error '91': Object variable or With block variable not set

Both of my subs have recently stopped working out of the blue. This first function copies the contents of a .txt file, sorts them, and sends them to the appropriate tables., and I've no idea why it stopped working. I can't seem to resolve the Issue…
1
vote
2 answers

Why does using single quotes with variables yield error "A positional parameter cannot be found that accepts argument"?

I have an variable: $a = sfd. If I use New-Item '1'$a, then it will yield this error: New-Item: A positional parameter cannot be found that accepts argument 'sdf'. But if I use New-Item "1$a" then it works. According to How do I concatenate strings…
Ooker
  • 1,969
  • 4
  • 28
  • 58
1
vote
2 answers

Why Lua's ternary operator is preventing my function to return several values?

As summary states. Lets say I want o resolve my ReturnFunction in a ternary operator fashion. Well, as far as I know, as long as my function returning several values (ReturnThreeValues) is placed at LAST position after ReturnFunction's return, the…
Rai
  • 314
  • 1
  • 2
  • 9
1
vote
1 answer

struct value not being able to enter text

How can I make user enter custom message for the msgbuf.mtext? Whenever I try to change it manually I am getting following error: struct msgbuf msg expression must be a modifiable lvalue What am I doing wrong? struct msgbuf { long mtype; …
Halaviw
  • 75
  • 6
1
vote
1 answer

Change variable in array coded with processing

Help! I'm drawing a sketch with randomized letters that fill the screen. The code issue is with my for (int i = 0; i < I1; i++) { targets = tX + i * ts; targets2 = tY; } else { runTowards = false; for (int i = 0; i < I1; i++) { targets =…
1
vote
2 answers

Should I use an explicit return type for a String variable in Kotlin?

In Kotlin, We can declare a string read-only variable with type assignment and without type assignment (inferred) as below. val variable_name = "Hello world" or val variable_name: String = "Hello world" I'm trying to figure out what is the best in…
KZoNE
  • 1,249
  • 1
  • 16
  • 27
1
vote
0 answers

Batch - Findstr - Escape chars

I have a textfile/logfile called textexample.txt with a lot of lines which was generated from a 3rd Party Software and therefore does contain a lot of special characters. Now im searching for some special keywords in this logfile and therefore i use…
Felix Waltl
  • 129
  • 6