Questions tagged [declare]

Use this tag for questions related to declare, which is usually meant for declaring variables, statements, etc.

642 questions
5
votes
4 answers

Cant declare variable SQL

I've been trying to declare an integer variable but its just not working. Here is my query: DECLARE @count INT SET @count = 5633 SELECT count(matchid) FROM `matches` WHERE id = @count Im getting this error: Error Code: 1064. You have an…
James Stevenson
  • 79
  • 1
  • 1
  • 5
5
votes
1 answer

Devel::Declare removes line from script

I am trying to learn Devel::Declare so as to attempt to reimplement something like PDL::NiceSlice without source filters. I was getting somewhere when I noticed that it was removing the next line from my script. To illustrate I have made this…
Joel Berger
  • 19,816
  • 5
  • 47
  • 101
5
votes
2 answers

how can i declare variables via macros?

first of all, I'm using MS's Visual Studio and using C language. Recently I need to declare variables with just one same statement which likes a macro. However as you know, I can declare just one variable which have same name. for example, this…
Darpangs
  • 71
  • 1
  • 1
  • 6
5
votes
2 answers

What are the limitations of forward declaring in Clojure? Why can't I use comp in this example?

I like my code to have a "top-down" structure, and that means I want to do exactly the opposite from what is natural in Clojure: functions being defined before they are used. This shouldn't be a problem, though, because I could theoretically declare…
dividebyzero
  • 1,965
  • 1
  • 19
  • 28
5
votes
1 answer

Bash: How to persist and restore associative arrays with keys that contain square brackets or other special characters

Problem Sourcing the result of declare -p for a valid Bash associative array in which keys contain square brackets results in a bad array subscript error. Testing Procedure Do: $ declare -A array $ key='var[0]' $ array["$key"]=37 $ echo…
Steve Amerige
  • 1,099
  • 1
  • 10
  • 25
5
votes
2 answers

Using this or new in JS?

I've got 3 codes : var control = new Control(); function Control() { this.doSomethingElse = function() {...} this.doSomething = function () { control.doSomethingElse(); } } Or var control = new Control(); function Control() { …
alexino2
  • 91
  • 9
5
votes
1 answer

JavaScript: Can I declare variables inside switch cases?

In C language, you cannot declare any variables inside 'case' statements. switch ( i ){ case 1: int a = 1; //error! break; } However, you can when you use with curly parentheses. switch ( i ){ case 1: {// create another scope. int a = 1;…
PRIX
  • 63
  • 1
  • 4
5
votes
2 answers

declare not a valid identifier bash

I have a problem with my a bash script. What I do is assign variables like this. for ((i=START;i<=END;i++) declare var$i=$(something) done And it works, but now I have a problem with finnish characters like å, ä, ö. What declare says is…
jim
  • 53
  • 2
  • 6
5
votes
1 answer

Typescript - How to overide declaration in lib.d.ts

Is there any way to override a var declaration in d.ts file? initTaggingControls() { RTE.CanvasEvents.registerListener(RTE.CanvasEvents.editableRegionChangedEvent, Function.createDelegate(null, this.onCustomTextChanged)); …
ppatalong
  • 153
  • 7
5
votes
3 answers

vb.net - How to Declare new task as SUB with parameters

As you know we have a new syntax in vb.net with possibility to create inline tasks so we could run it asynchronously. This is the correct code: Dim testDeclaring As New Task(Sub() End Sub) …
newbeee
  • 65
  • 1
  • 2
  • 5
5
votes
1 answer

Explain this confusing dojo tutorial syntax for declare

I am reading the syntax for using dojo's declare for class creation. The description is confusing: The declare function is defined in the dojo/_base/declare module. declare accepts three arguments: className, superClass, and…
Jeremy
  • 2,959
  • 1
  • 29
  • 38
5
votes
1 answer

T-SQL Use CTE to initialize variables inside a view

I need to create a view - it is composed by five UNION ALL statements. The difference between each statement is that the data is filter by different period: For example: SELECT RecordName ,CASE WHEN RecordDate >…
gotqn
  • 36,464
  • 39
  • 145
  • 218
4
votes
8 answers

Declaring variable in FOR loop

I know in C++ that you can declare on variables inside the FOR, e.g: for(int i=0; i<10; i++) is there any way to declare another variables inside the for? this won't work for me: for(int i=0, char Ch='J'; i<10; i++)
Jjang
  • 193
  • 1
  • 3
  • 13
4
votes
3 answers

Struct with an array as variable in c

i need to create a data type (struct in this case) with an array as a property. I have an initialiser function that initialises this data structure and gives the array a specified size. The problem now is declaring the array in the struct. for…
pnizzle
  • 5,359
  • 3
  • 38
  • 70
4
votes
1 answer

C90: How do I globally initialize this struct in C without C99 extensions

I was wondering what the best way to initialize this struct is with C90, while still keeping it neat. In my header file, call it test.h, I have the following struct defined: struct s_test_cfg{ char *a[3]; char *b[3]; char *c[3]; …
Jack
  • 351
  • 2
  • 4
  • 16