Questions tagged [var]

var is a keyword in a number of programming languages.

In computer programming, a variable or scalar is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value.

The variable statement declares a variable, optionally initializing it to a value.

In C# it is used to declare a variable of an implied type.

Beginning in Visual C# 3.0, variables that are declared at method scope can have an implicit type var. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type. The following two declarations of i are functionally equivalent:

 var i = 10; // implicitly typed
 int i = 10; //explicitly typed

References:

2462 questions
0
votes
1 answer

a variable defined with let is not defined in a same scope IIFE

I have some code below. I hope it can log a and b correctly, but as the result, it logs a as 1, b is not defined with error: Uncaught ReferenceError: b is not defined function foo(){ var a = 1 let b = 2 (function bar() { …
shuizhongyuemin
  • 559
  • 5
  • 11
0
votes
3 answers

Is let the same used inside and outside a loop

The question pop up in my head when I read example 6 in this post https://stackoverflow.com/a/111111/6359753 Will there ever be a difference between // Example 1 let i; var arr = [1,2,3] for (i=0; i
Henry Yang
  • 2,283
  • 3
  • 21
  • 38
0
votes
1 answer

What is a real-world example of block scope being useful in JavaScript?

let and const have introduced block-level scoping to JavaScript, and I now understand the difference. But I'm yet to find a compelling real-world example where let has an advantage over var. What does block-scoping offer in practical terms…
DavidR
  • 359
  • 1
  • 4
  • 15
0
votes
2 answers

showing variable content with datalist JS / mark some output as a variable name

So,I want to create a program,which can show me something,if I enter something (with the help of a datalist). Because I don´t want to code for every possibility,I want to ask,if you can say,that the value of the Textbox should show the text inside…
Adolf Weii
  • 23
  • 6
0
votes
1 answer

How to display a "file properties page" via scripting

How can I display the Windows Explorer "file properties page" via scripting code? I have search with Google and have found no answers. Something like... This code opens a Windows Explorer folder to path and selects file. var path=(path to…
Jim Kolb
  • 21
  • 5
0
votes
2 answers

cant get a variable equal in a loop

So I'm just trying to learn programming/coding. and I'm trying to make a loop where the computer guesses at random a number that I put in (the variable), I mostly the loop with the "while" and "if/else" loops down but like...idk how to put the…
0
votes
1 answer

bash, find all strings in a var

I'm Making a script to get DAR information out of video file. to do that, I'm using this script with success DAR=$(ffmpeg -i "$DOSSIER/$OLD_NAME.$EXTENSION" -hide_banner 2>&1 | grep -i -oP "DAR [0-9]+:[0-9]+") # if DAR not exist set it to 1 if [ -z…
Nexius2
  • 11
  • 4
0
votes
1 answer

How to use val instead of var in below Scala Code

How to use val instead of var in below Scala Code var index: Long = lower var sum = 0L while(index <= upper) { if(number % index == 0L) sum += index index += 1L } sum
0
votes
2 answers

Unable to assign value to a var inside try in Scala

In my program, I have: val f = Source.fromURL(url) var lineList try lineList = f.getLines.toList finally f.close() I get compilation error: Error:(13, 1) '=' expected but ';' found. try lineList = f.getLines.toList finally f.close() What…
Mandroid
  • 6,200
  • 12
  • 64
  • 134
0
votes
2 answers

tkinter 'var' for radiobutton is always returning 0

from the List of radio button I want to know which one was clicked Whenever a radio button (In python Tkinter) is clicked its returning 0... I tried the following method: declaring the 'var' variable global passing var variable in all…
0
votes
2 answers

my jquery var is logging something odd

I am somewhat new to jquery. Can any one tell me what's wrong with this? var l = $(target)+".thumb".length; The console log returns this: [object Object]6 I have the "target" var set up ahead of the "l" var (along with another var) like this: var…
belotte
  • 23
  • 4
0
votes
3 answers

Make new JavaScript variable by combining string & variable

So this is my problem. pageTitle1 = ('This is page one'); pageTitle2 = ('This is page two'); pageTitle3 = ('This is page three'); currentPageTitle = ('pageTitle'+currentPosition); $("#pageNumber").html(currentPageTitle); I'm trying to display the…
Mike
  • 3
  • 1
  • 2
0
votes
1 answer

Multiple variable names in VAR causality function

I'm working on some code to determine granger causalities for a set of financial and public interest data. I've run into a bit of an issue with the syntax of the causality() function within the VAR package. Here's a sample of code and its potential…
Chris
  • 21
  • 5
0
votes
1 answer

Why is "var" a legal type name in C#?

As it turns out, you can create a class named var and instantiate it with new var();. What influenced the C# developers to allow this to happen with var but not other keywords?
user1306322
  • 8,561
  • 18
  • 61
  • 122
0
votes
1 answer

PHP session dat being overwritten

Dear all, I am having a php session problem. PHP 5.2.6 MySQL 4.1.22 I have initiated a login for admin and all session data is good. A list of users is called for user administration. User is selected and an 'id' is passed [using GET for…
1 2 3
99
100