variable-assignment Questions

3

Solved

This instruction works: SELECT INTO unsolvedNodes array_agg(DISTINCT idDestination) FROM road WHERE idOrigin = ANY(solvedNodes) AND NOT (idDestination = ANY(solvedNodes)); But I would like to use...
Titi asked 1/5, 2013 at 1:51

2

While finalizing my upcoming Raku Advent Calendar post on sigils, I decided to double-check my understanding of the type constraints that sigils create. The docs describe sigil type constraints wit...
Interviewer asked 19/12, 2022 at 4:12

7

Solved

Am not new to JS or its syntax, but sometimes, the semantics of the language has me stumped at times. At work today, a colleague mentioned this: var a = b = []; is not the same as var a = [], b...
Ament asked 2/8, 2010 at 11:26

12

Solved

I need to assign the output of a program to a variable using a MS batch file. So in GNU Bash shell I would use VAR=$(application arg0 arg1). I need a similar behavior in Windows using a batch file....
Ivers asked 24/2, 2010 at 2:33

12

Solved

C++ Notes: Array Initialization has a nice list over initialization of arrays. I have a int array[100] = {-1}; expecting it to be full with -1's but its not, only first value is and the rest are...

7

Solved

I've seen them both being used in numerous pieces of C# code, and I'd like to know when to use i++ and when to use ++i? (i being a number variable like int, float, double, etc).
Tineid asked 27/7, 2010 at 18:1

5

Solved

This code is provided as an example in for use with devise and OmniAuth, it works in my project. class User < ActiveRecord::Base def self.new_with_session(params, session) super.tap do |user|...
Anastice asked 10/6, 2015 at 22:25

7

Solved

A script takes a URL, parses it for the required fields, and redirects its output to be saved in a file, file.txt. The output is saved on a new line each time a field has been found. file.txt A ...
Cockahoop asked 22/6, 2015 at 19:50

8

Solved

var var1 = 1, var2 = 1, var3 = 1; This is equivalent to this: var var1 = var2 = var3 = 1; I'm fairly certain this is the order the variables are defined: var3, var2, var1, which would be equ...
Phidippides asked 18/11, 2009 at 19:48

15

I want to assign multiple variables in a single line in R. Is it possible to do something like this? values # initialize some vector of values (a, b) = values[c(2,4)] # assign a and b to values at...
Toritorie asked 22/9, 2011 at 18:44

6

Solved

Does exist in linux bash something similar to the following code in PHP: list($var1, $var2, $var3) = function_that_returns_a_three_element_array() ; i.e. you assign in one sentence a correspondi...
Selfsufficient asked 23/12, 2009 at 12:3

3

Solved

I'm quite acquainted with Python's ternary operator approach: value = foo if something else bar My question is very simple: without prior assignments, is there anyway to reference the term being...

5

Solved

I've been learning Python for a few months, and also know very little C, and I was wondering if anyone could clear this doubt up for me: Is a variable the name, the value, or the memory location? ...
Wieland asked 1/11, 2013 at 4:52

4

I would like to know how can I set a variable with another variable in jinja. I will explain, I have got a submenu and I would like show which link is active. I tried this: {% set active_link = {{...
Osier asked 16/9, 2010 at 13:18

5

Given a class like this: class Foo { const int a; }; Is it possible to put that class in a vector? When I try, my compiler tells me it can't use the default assignment operator. I try to write ...
Carpogonium asked 26/5, 2010 at 22:20

5

Solved

How do I initialize ('declare') an empty bytes variable in Python 3? I am trying to receive chunks of bytes, and later change that to a utf-8 string. However, I'm not sure how to initialize the ini...
Concerto asked 21/5, 2013 at 19:53

1

Solved

Since PHP7.1, a foreach() expression can implement array destructuring as a way of unpacking row values and make individualized variable assignments. When using array destructuring within a foreach...
Knowhow asked 9/4, 2022 at 12:16

9

Solved

I have @obj.items_per_page, which is 20 at the beginning, and I want the method below to assign value to it only if many_items is not nil: def fetch_it_baby (many_items = nil) @obj.items_per_page...
Steatite asked 1/10, 2013 at 10:47

1

Solved

[I ran into the issues that prompted this question and my previous question at the same time, but decided the two questions deserve to be separate.] The docs describe using destructuring assignment...
Amphibian asked 11/9, 2021 at 23:55

1

Solved

In a classic foreach() loop after the word as, is it possible to use the key variable as part of the value variable or vice versa? * after more than a decade of PHP development, this possibility on...
Aniconic asked 8/2, 2022 at 8:33

8

Solved

Is it possible to declare multiple variables at once using Golang? For example in Python you can type this: a = b = c = 80 and all values will be 80.
Turnbuckle asked 12/1, 2014 at 5:4

5

Solved

(Don't worry, this isn't another question about unpacking tuples.) In python, a statement like foo = bar = baz = 5 assigns the variables foo, bar, and baz to 5. It assigns these variables from lef...
Kalfas asked 22/8, 2015 at 13:9

3

In Java you can declare a private final member variable and then initialize it from your constructor, which is very useful and is a very common thing to do: class MyClass { private final int widg...
Refrain asked 25/12, 2021 at 16:5

14

Solved

Is it possible to declare a variable in Python, like so?: var so that it initialized to None? It seems like Python allows this, but as soon as you access it, it crashes. Is this possible? If not, ...
Jerome asked 19/3, 2009 at 22:21

2

Solved

begin; create type public.ltree as (a int, b int); create table public.parent_tree(parent_id int,l_tree ltree); insert into public.parent_tree values(1,(2,2)),(2,(1,2)),(3, (1,28)); commit; Trying...
Howlend asked 30/11, 2021 at 8:47

© 2022 - 2024 — McMap. All rights reserved.