variable-declaration Questions

13

Solved

I have a global variable in JavaScript (actually a window property, but I don't think it matters) which was already populated by a previous script, but I don't want another script that will run lat...

8

Solved

I'm coding a small program to time and show, in a ordered fashion, my Rubik's cube solvings. But Python (3) keeps bothering me about times being used prior to global declaration. But what's strange...

7

Solved

I want to clarify how variables are declared in Python. I have seen variable declaration as class writer: path = "" sometimes, there is no explicit declaration but just initialization...
Laue asked 13/6, 2012 at 2:54

9

Solved

I'm curious to know the difference between declaring a variable, and initializing a variable. e.g. var example; // this is declaring var example = "hi" // initializing? Or just "adding a value"? ...

6

Solved

I want to perform Destructuring in php just like in javascript code below: [a, b, ...rest] = [10, 20, 30, 40, 50]; console.log(a,b,rest); Output: 10 20 [ 30, 40, 50 ] How can I preform that opera...
Dermatologist asked 3/3, 2023 at 5:58

4

Solved

I have a line like this in my code: list($user_id, $name, $limit, $remaining, $reset) = explode('|', $user); The last 3 parameters may or may not be there. Is there a function similar to list that...
Irreversible asked 12/3, 2013 at 15:31

3

Solved

In The C Programming Language, 2nd Edition, by authors Brian W. Kernighan and Dennis M. Ritchie, they talk about declarators and direct-declarators. The discussion starts in the book on p. 122 with...

3

Solved

I have been implementing a Wordpress plugin and I faced a problem with finding out if a variable has been declared or not. Let's say I have a model named Hello; this model has 2 variables as hello_...
Linsk asked 1/8, 2015 at 12:57

3

Solved

Does C++11 allow declaring non-static data members as 'auto' if they are initialized in the declaration? For example: struct S { auto x = 5; // in place of 'int x = 5;', which is definitely allow...
Ralphralston asked 3/7, 2012 at 0:28

9

Solved

Question #1: Is declaring a variable inside a loop a good practice or bad practice? I've read the other threads about whether or not there is a performance issue (most said no), and that you shoul...
Tapping asked 31/10, 2011 at 20:50

9

Solved

I want to do this but it won't compile: Public MyVariable as Integer = 123 What's the best way of achieving this?
Trichiasis asked 5/5, 2011 at 12:42

4

I usually see in almost all of VBA codes all variables are declared after e.g. Sub/Function name line I know and I used variable declaration in the middle of some of my codes (Not inside a loop) an...
Terylene asked 19/12, 2021 at 8:48

14

Solved

Is it possible to declare a variable in Python, like so?: var so that it initialized to None? It seems like Python allows this, but as soon as you access it, it crashes. Is this possible? If not, ...
Jerome asked 19/3, 2009 at 22:21

8

Solved

Looking at an online source code I came across this at the top of several source files. var FOO = FOO || {}; FOO.Bar = …; But I have no idea what || {} does. I know {} is equal to new Object() ...
Tishatishri asked 22/6, 2011 at 12:10

2

Solved

In D, how do I declare an either const or immutable pointer to non-const / mutable data in D? The dlang website says you can't just declare it as const, as this makes both the pointer const and th...

11

Solved

I'm declaring some strings that are empty, so it won't throw errors later on. I've read that this was the proper way: string Camnr = Klantnr = Ordernr = Bonnr = Volgnr = Omschrijving = Startdatum...
Pallaton asked 14/11, 2012 at 7:13

1

Solved

I'm learning about the alternate variable declarations introduced in ES6. Right now, I have learned that the 'let' variable declaration is block scoped, and although it can be updated, it cannot be...

8

Question How to declare a string variable in C? Background In my quest to learn the basics of c, I am trying to port one of my oldest python programs, Bob, to C. In the program, the script asks ...
Arrack asked 14/3, 2013 at 21:37

5

Solved

Can I convert the following declaration and assignment into one line: Dim clientToTest As String clientToTest = clientsToTest(i) or Dim clientString As Variant clientString = Split(clientToTest) ...
Rodie asked 15/7, 2010 at 13:47

12

Solved

What is the difference between the following declarations: int* arr1[8]; int (*arr2)[8]; int *(arr3[8]); What is the general rule for understanding more complex declarations?
Uziel asked 13/5, 2009 at 18:35

2

I have code like this: let accessAllowed; accessAllowed = (2>18) ? true : false; alert(accessAllowed); However when I use this: let accessAllowed; let accessAllowed = (2>18) ? true : false;...
Gibeonite asked 14/12, 2017 at 6:33

1

Solved

C#9 was officially announced a couple days ago. One new language features is "target-typed new expressions", which feel pretty similar in usage to var. Comparing the following declarations, I'm cur...
Trimble asked 21/5, 2020 at 17:19

3

Solved

Scott Meyers writes in Effective Modern C++ (Item 30, at page 210) that there's no need to define integral static const data members in classes; declarations alone suffice, then the sample code i...
Gassing asked 17/5, 2020 at 18:11

4

Solved

I started working with go for a few weeks, and (once again) I stumbled across something that seems odd for me: // Not working a := 1 { a, b := 2, 3 } // Works a := 1 a, b := 2, 3 playground I...
Unlimited asked 20/5, 2016 at 16:1

8

Solved

I can't understand why variables act so strange when declared inside a function. In the first function I declare with let the variables b and c with the value 10: b = c = 10; In the second fun...
Windrow asked 27/1, 2020 at 12:58

© 2022 - 2024 — McMap. All rights reserved.