Questions tagged [unassigned-variable]
93 questions
0
votes
2 answers
How to output all unassigned strings in a python file
I have a python file (a script) that looks like this:
script.py
"""
Multiline comment with unique
text pertaining to the Foo class
"""
class Foo():
pass
"""
Multiline comment with unique
text pertaining to the Bar class
"""
class Bar():
…

Charles Clayton
- 17,005
- 11
- 87
- 120
0
votes
2 answers
When changing a variable within if / else block an error says it is unassigned
I am trying to change the color of a ball randomly however when I try to use the color variable to become the color of the solid brush it says that it is unassigned. "Use of unassigned local variable 'ballColour'"
xPos = xPos + GAP_SIZE;
…

Jennifer Taylor
- 47
- 2
0
votes
2 answers
c# Multi-Dimensional Array verification
I´m trying to read the array below. What i want to do is just verify if the number 1 and 2 exists at the same time in the array. The problem is with my method. I keep getting an "use of unassigned local variable 'jogavel1'", that is inside my…

Angelo Bastos
- 37
- 7
0
votes
2 answers
How can I show a string representation of a nullable DateTime type?
The user supplies "from" and "to" months for a report to be generated (e.g., from 1 month back to 13 months back; if they choose this on 2/15/2016, the return values are 1/1/2015 and 1/1/2016).
I want to allow the user to select either the furthest…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
0
votes
2 answers
Unassigned variable error
using System;
namespace ConsoleApplication
{
class Program
{
public delegate void mydel(int z);
static void Main(string[] args)
{
Program p = new Program();
Random r = new Random();
…

Lyrk
- 1,936
- 4
- 26
- 48
0
votes
2 answers
Use of unassigned local variable when taking the address of variable
Why in this code compiler does not show error Use of unassigned local variable when taking the address of that variable?
int i;
int* p = &i; // Use of unassigned local variable i ?
int j = *p; // j = 0
j = i; // both valid
This will compile…

M.kazem Akhgary
- 18,645
- 8
- 57
- 118
0
votes
1 answer
elasticsearch returns "Unassigned"
When I index any document in elasticsearch, I always find out that the data is Unassigned. When I try to search, sort, delete or update any data it data, it works perfectly.
The Cluster health is yellow:
Here is the index metadata:
{
"state":…

Istiak Mahmood
- 2,330
- 8
- 31
- 73
0
votes
3 answers
use of local unassigned variable C#
I have a problem I do not understand (probably very easy to solve).
int[] numbers;
numbers[0] = 0;
when I debug, the second line gets error:
"use of unassigned local variable"
How do I get rid of it?

Jimbutter10
- 3
- 2
0
votes
4 answers
My compiler keeps saying I didn't assign my variable
I am trying to write a program that simulates a car race competition, the user inserts the number of cars in the competition and the time of each car. The program will print the car with the fastest time and the car with the second fastest time.
So…

Amnon Hanuhov
- 21
- 1
- 3
- 9
0
votes
2 answers
Assigned a value that is never used (simple program)
#include
#include
int main ()
{
int numc;
puts ("NUMBER PLEASE");
numc=getchar();
printf ("%d");
getch ();
return 0;
}
I get the warning numc is assigned a value that is never used, while I'm trying to get the value.…

SirVirgin
- 153
- 1
- 3
- 10
0
votes
2 answers
C# Script Error "Use of Unassigned variable 'line'?
At this time, I am developing a script that will take employee information and display the info in a particular way IN this case, I attempted to use the `.ToString' method so keep the input displayed on the same line without creating a new line I…

Mckenzo101
- 1
- 1
0
votes
1 answer
how to get rid of compiler error: C# use of unassigned local variable?
I have some questions why C# doesn't like the coordinates[j] part and what I can do about it.
string[] lines = System.IO.File.ReadAllLines(@"C:\Users\sp\Dropbox\ProjectEuler\102\p102_triangles.txt");
string[] coordinates_str;
double[] coordinates;…

SwimBikeRun
- 4,192
- 11
- 49
- 85
0
votes
1 answer
How to differenciate a not assigned public int property new instance object from an assigned one
Lets have a simple class with an int property
public class SimpleClass {
public int myInt { get; set; }// for having a property and not "public int myInt;", see Jon Skeet remark
}
I instanciate it twice assigning myInt or not
…

tit
- 599
- 3
- 6
- 25
0
votes
4 answers
Use of unassigned bool? local variable
i have this:
foreach (Software.dsBDD.list_table21 row in dataTable.Rows)
{
PictureBox box;
MemoryStream stream;
Panel panel;
Label label;
bool? pass;
if…

Gambarsky
- 15
- 2
- 8
0
votes
6 answers
C# use of unassigned variable?
So basically I have a class for a TicTacToe game and a derived class just to practice using inheritance. The class has several methods and all should work perfectly fine but in the main function, when I finally make three objects of the derived…

user3471066
- 159
- 1
- 2
- 7