Skip to main content
4 votes
0 answers
44 views

Why does using 'this' in a Java instance initializer block resolve forward reference errors? [duplicate]

Problem Description I've encountered an interesting behavior in Java regarding forward references in instance initializer blocks. When I try to access an instance variable directly, I get a forward ...
happy's user avatar
  • 517
-4 votes
1 answer
109 views

Creating custom keywords in C++ using libraries [closed]

I want to create a keyword that modifies a variable during definition. Similar to how long long var; creates something different than long var;, or static int var; does something special to the ...
ShieldCat's user avatar
  • 113
-2 votes
1 answer
52 views

Python: Making a distinct copy of each class object in a list [duplicate]

How do I make a copy of a list of objects in a Python class such that each of the copies is a distinct instance of said Python class? Suppose I have a Python class class myClass(): def __init__(...
gdd's user avatar
  • 121
-1 votes
3 answers
131 views

Is this an elegant way to initialize a variable for the first iteration of a loop? [closed]

This is a C program that copies its input to its output, replacing each string of one or more blanks by a single blank. I don't know what is the best way to proceed when the program starts and there ...
ivangouba's user avatar
0 votes
2 answers
117 views

C - ternary operator in initialization statement of a for-loop

I am quite new to C and preparing for a test by working through some sample questions. Given the code below, I don't understand the initialization of int j by using the ternary operator. for (int j = ...
paranoid_android's user avatar
1 vote
2 answers
376 views

Why Does PowerShell Complain It Can't Retrieve a Variable?

I'm getting the following error message: The variable '$dateTime' cannot be retrieved because it has not been set. The error is generated by the line [DateTime]$dateTime in this code: [string]$...
aksarben's user avatar
  • 628
0 votes
1 answer
230 views

how to interpolate workflow level variable into another workflow level variable github actions

I'm new to github actions. Below is my workflow: name: Example on: [push, workflow_dispatch] env: APPNAME: 'myapp1' APPURL: "https://mybank/$APPNAME/widgets/hello.json" jobs: test: ...
Ashar's user avatar
  • 3,161
0 votes
2 answers
98 views

Variable initialization in Javascript

There is something that I couldn't understand. I have the following code, which its purpose is to get the total of the two arrays. let r1; let r2; let total; function totalSum(arr_1, arr_2) { ...
Ameen Shamsan's user avatar
0 votes
0 answers
56 views

Concept issues about initializing avariable in C++ class

I'm translating a script form matlab to C++ and I'm given a code snipet in c++ so I can fill it. My BIG issue is that my knowledge about C++ is almost nothing, I know how classes work in a basic way ...
mikel lasa's user avatar
0 votes
1 answer
38 views

Is there a way in Java to make labels move without user influence?

I am trying to develop an application where the user moves a can back and forth on the bottom of the screen to try to catch bees as they fall. I have successfullly gotten the can movement working, but ...
jajuub's user avatar
  • 3
0 votes
1 answer
37 views

Why does initialising the variable outside the event handler and then reassigning it only allow the code to work once?

I'm making a BMI calculator and it works only one time. Which I don't understand. I initialised 2 let variables outside the click event handler just to get the input elements. When I wanted to convert ...
Duuliye's user avatar
0 votes
1 answer
379 views

Detect and prevent processing of sequential duplicate Tradingview webhook json

I am not very well acquainted with python, but have by much trial and error, and building upon the work of others, developed a simple working and reliable interface between Tradingview (TV) and ...
Snorkel's user avatar
  • 11
0 votes
2 answers
733 views

Why can't a global variable be initialised from another global?

int a = 5; int b = a; //error, a is not a constant expression int main(void) { static int c = a; //error, a is not a constant expression int d = a; //okay, a don't have to be a constant ...
BBquestions's user avatar
1 vote
1 answer
169 views

Why is Java forcing me to initialize my String before letting the user input the value of the String?

I'm essentially making a small, simply "twenty questions" style program, using nested if-statements to try to guess what object the user is thinking based on clarifying questions. I'm using ...
dissidenttux's user avatar
2 votes
1 answer
131 views

What's the difference between Radio r = Radio("PSR", 100.8) and Radio("PSR", 100.8)? [duplicate]

I'm new to C++ and trying to understand something. I have this code in my main.cpp: Radio r = Radio("PSR", 100.8); or that code: Radio r("PSR", 100.8); Both seem to work and ...
Sten Göring's user avatar

15 30 50 per page
1
2 3 4 5
9