Use this tag for questions related to declare, which is usually meant for declaring variables, statements, etc.
Questions tagged [declare]
736 questions
244
votes
6 answers
How to declare an ArrayList with values?
ArrayList or List declaration in Java has questioned and answered how to declare an empty ArrayList but how do I declare an ArrayList with values?
I've tried the following but it returns a syntax error:
import java.io.IOException;
import…

alvas
- 115,346
- 109
- 446
- 738
135
votes
10 answers
How do I use variables in Oracle SQL Developer?
Below is an example of using variables in SQL Server 2000.
DECLARE @EmpIDVar INT
SET @EmpIDVar = 1234
SELECT *
FROM Employees
WHERE EmployeeID = @EmpIDVar
I want to do the exact same thing in Oracle using SQL Developer without additional…

Nathan
- 1,351
- 2
- 9
- 3
133
votes
2 answers
Declare variable in table valued function
How can I declare a variable in a table valued function?

esquare
- 3,947
- 10
- 34
- 37
107
votes
11 answers
SELECT INTO Variable in MySQL DECLARE causes syntax error?
I´d like to SELECT a single value into a variable. I´d tried to following:
DECLARE myvar INT(4);
-- immediately returns some syntax error.
SELECT myvalue
FROM mytable
WHERE anothervalue = 1;
-- returns a single integer
SELECT myvalue
INTO…

Matt Bannert
- 27,631
- 38
- 141
- 207
102
votes
15 answers
Declaring array of objects
I have a variable which is an array and I want every element of the array to act as an object by default. To achieve this, I can do something like this in my code.
var sample = new Array();
sample[0] = new Object();
sample[1] = new Object();
This…

Prasath K
- 4,950
- 7
- 23
- 35
64
votes
4 answers
C function pointer syntax
Normally, when declaring some variable, you put its type before it, like:
int a;
a function pointer may have type like: int(*)(int,int), in case we point to a function that takes two integers and returns an integer. But, when declaring such a…

user1941583
- 761
- 1
- 5
- 9
63
votes
2 answers
typescript declare third party modules
How could I declare a third party module which looks like this:
in third party module:
module.exports = function foo(){
// do somthing
}
in my code:
import * as foo from 'foo-module'; // Can not find a declaration module for ...
foo();

Saman Mohamadi
- 4,454
- 4
- 38
- 58
62
votes
3 answers
Differences between declare, typeset and local variable in Bash
When typing variables in Bash, what is the difference between declare and typeset? When used inside a function: what is the difference between declare and typeset and local?
The only difference I have come across is that typeset is portable to ksh…

lecodesportif
- 10,737
- 9
- 38
- 58
54
votes
2 answers
What does "#!/bin/env" mean (at the top of a node.js script)?
I found serval node.js projects that have this at top of their app.js (as in this openshift program):
#!/bin/env node
What does this mean? How does this work? Where is it useful?

hh54188
- 14,887
- 32
- 113
- 184
45
votes
7 answers
name 'times' is used prior to global declaration - But IT IS declared
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 is that IT IS declared, right on the beggining, as…

AntonioPT
- 473
- 1
- 4
- 8
44
votes
6 answers
Declare multiple variables in JavaScript
I want to declare multiple variables in a function:
function foo() {
var src_arr = new Array();
var caption_arr = new Array();
var fav_arr = new Array();
var hidden_arr = new Array();
}
Is this the correct way to do…

FFish
- 10,964
- 34
- 95
- 136
38
votes
10 answers
Why use constants in programming?
I've just been going back over a bit of C studying using Ivor Horton's Beginning C book. I got to the bit about declaring constants which seems to get mixed up with variables in the same sentence.
Just to clarify, what is the difference in…

Adam N
- 389
- 1
- 3
- 3
32
votes
2 answers
Can I declare the same variable twice in different for loops in JavaScript?
Possible Duplicate:
JavaScript Variable Scope
I have a JavaScript function for HTML select options for days:
// Show and hide days according to the selected year and month.
function show_and_hide_days(fp_form) {
var select_year=…

Uri
- 2,992
- 8
- 43
- 86
32
votes
4 answers
MySQL local variables
I am trying to define and initialize a MySQL variable for a query.
I have the following:
declare @countTotal int;
SET @countTotal = select COUNT(*)
from nGrams;
I am using MySQL in Netbeans and it tells me I have an error. What/where is my…

CodeKingPlusPlus
- 15,383
- 51
- 135
- 216
31
votes
2 answers
PHP using Declare ? What is a tick?
I am a little bit confused by the PHP function declare.
What exactly is a single tick? I thought a tick equals one line of code?
But if I use:
function myfunc() {
print "Tick";
}
register_tick_function("myfunc");
declare(ticks=1) {
…

opHASnoNAME
- 20,224
- 26
- 98
- 143