variable-assignment Questions

2

Solved

I'm confused about '=' operator, and tf.identity(), I thought '=' is to just make a reference of the tensor, and identity is to make a copy, e.g., with ref = x ref = ref*0 sess.run(x) I will get...

3

Solved

public class Java{ public static void main(String[] args){ final byte x = 1; final byte y = 2; byte z = x + y;//ok System.out.println(z); byte a = 1; byte b = 2; byte c = a + b; //Compiler...
Majewski asked 27/10, 2012 at 12:3

3

Solved

I am poking into the manuals, I wanted to ask the community: How can we set global variables inside a function?
Matriarchy asked 6/8, 2009 at 2:3

4

Solved

If I do this: p=list(range(10)) p[2:6:1]=['a','b'] I get p=[0, 1, 'a', 'b', 6, 7, 8, 9] which means Python is replacing the the elements indexed 2-5 with the new list ['a','b']. Now when, I ...
Tripod asked 26/6, 2020 at 13:19

4

Solved

C++ Primer says that character and string literals may be converted to strings. I tried assigning a character to a string as: std::string s; s = 's'; And it gave me no error. But, when I tried to ...
Ossa asked 25/6, 2020 at 10:37

2

Solved

C++ does not allow copying of C-style arrays using =. But allows copying of structures using =, as in this link -> Copying array in C v/s copying structure in C.It does not have any credible answer...
Ronnironnica asked 3/6, 2020 at 7:33

2

Solved

How can I assign the same value for multiple variables in PHP at once ? I have something like: $var_a = 'A'; $var_b = 'A'; $same_var = 'A'; $var_d = 'A'; $some_var ='A'; In my case, I can't ren...
Squiffy asked 25/7, 2012 at 14:6

4

Solved

I started working with go for a few weeks, and (once again) I stumbled across something that seems odd for me: // Not working a := 1 { a, b := 2, 3 } // Works a := 1 a, b := 2, 3 playground I...
Unlimited asked 20/5, 2016 at 16:1

13

I have a list of objects and I want to remove all objects that are empty except for one, using filter and a lambda expression. For example if the input is: [Object(name=""), Object(name="fake...
Licastro asked 8/6, 2011 at 16:23

3

Solved

Working with Futures in Dart, I've come across an interesting issue. import 'dart:async'; class Egg { String style; Egg(this.style); } Future cookEggs(List<Egg> list) => new Future...

4

Solved

The program available on The Go Playground reads package main import "fmt" func main() { var name string = nil fmt.Println(name) } and yields an error prog.go:6: cannot use nil as type stri...
Unfounded asked 15/3, 2016 at 2:10

5

Solved

I am working on an assignment and I'm stuck on this error: cannot assign a value to final variable count Here is my code so far... public class List { private final int Max = 25; private final ...
Washer asked 25/9, 2015 at 23:25

1

Solved

The increase assignment operator (+=) is often used in PowerShell questions and answers at the StackOverflow site to construct a collection objects, e.g.: $Collection = @() 1..$Size | ForEach-Objec...

7

Solved

I'm an amateur when it comes to programming, but I'm trying my hand at Python. Basically what I want to be able to do is use math on a dictionary value. The only way I could think to do it would be...
Elliot asked 16/11, 2012 at 23:42

8

I'm a first year computer engineering student and I'm quite new here. I have been learning Java for the past three and a half months, and C++ for six months before that. My knowledge of Java ...
Sollars asked 4/4, 2011 at 14:33

3

Solved

Most languages make it easy to take an array like [1, 2, 3] and assign those values to variables a, b, and c with a single command. For example, in Perl you can do ($a, $b, $c) = (1, 2, 3); What...
Catharina asked 2/2, 2010 at 7:57

4

Solved

Class A uses an initializer list to set the member to the paramter value, while Class B uses assignment within the constructor's body. Can anyone give any reason to prefer one over the other as lo...
Lyndseylyndsie asked 12/3, 2010 at 19:19

10

Solved

I just come across the statement in embedded c (dsPIC33) sample1 = sample2 = 0; Would this mean sample1 = 0; sample2 = 0; Why do they type it this way? Is this good or bad coding?
Supine asked 14/10, 2013 at 4:50

3

Solved

I'm writing a C compiler which follows this standard, and if I parse statements like this: int i; (i) = 1; my compiler will report an error which point out that (i) is a rvalue and should not be...
Digitigrade asked 12/10, 2019 at 9:13

4

Solved

A simple question about Python syntax. I want to assign a value from a function to a variable during the condition for a while loop. When the value returned from the function is false, the lo...
Fi asked 4/11, 2013 at 12:39

6

Solved

I want to conditionally assign a value to a variable if that variable is already null. Furthermore, if that variable is not already null I want nothing to occur and I want to be able to do all with...
Belcher asked 4/12, 2014 at 15:21

7

Solved

I am wondering why this doesn't work to assign a string to $separator: $separator = $options['title-separator'] || ' | '; Elsewhere, $option has been assigned to some text or an empty string. (A...
Divertissement asked 15/1, 2012 at 20:20

3

Solved

I am trying to build calculator using PyQt5 and I get string which I need to evaluate and assign it to a variable so that I can Pass that variable to widgets as an answer . So far I can evaluate th...
Shanahan asked 17/5, 2018 at 11:57

4

Solved

The basic example: var b = 10; var c = b; b++; console.log(b,c); >> 11 10 c looks like a copy of b. But in another case: var x = {}; var y = x; x.abc = 10; console.log(x.abc, y.abc); &...
Rackety asked 9/1, 2012 at 17:18

5

Solved

In a piano app, I'm assigning the coordinates of the black keys. Here is the line of code causing the error. 'blackKey' and 'whiteKey' are both customViews blackKey.center.x = (whiteKey.frame.ori...

© 2022 - 2024 — McMap. All rights reserved.