Top "Variable-assignment" questions

A process of setting or re-setting the value stored in the storage location(s) denoted by a variable name.

var vs := in Go

In the Go web server example here: http://golang.org/doc/effective_go.html#web_server The following line of …

go variable-assignment colon-equals
destructuring assignment default value

I am learning javascript and I got kind of stuck with ES6 syntax while trying to give a default value …

javascript reactjs ecmascript-6 variable-assignment destructuring
Block scope in ruby

My understanding was that ruby blocks have block scope, and all variables created inside block will live only within the …

ruby scope variable-assignment block
Java calling method and using ternary operator and assign in the parameters?

I was reviewing some code and I came across this: public static doSomething(String myString, String myString2) { //Stuff } public static …

java variable-assignment ternary method-call
Partially initializing a C struct

This link states that "When an automatic array or structure has a partial initializer, the remainder is initialized to 0". I …

c struct initialization variable-assignment
Why explicit conversion required to assign base class to derived class? But not required to do the reverse

I have a base class and a derived class as bellow public class animal { public string name { get; set; } } public …

c# types variable-assignment base derived
Golang mixed assignment and declaration

I started working with go for a few weeks, and (once again) I stumbled across something that seems odd for …

go variable-assignment variable-declaration
Destructuring assignment in JavaScript

As can be seen in the Mozilla changlog for JavaScript 1.7 they have added destructuring assignment. Sadly I'm not very fond …

javascript variable-assignment destructuring
Terraform: Pass a variable containing a list of strings to a jsonencode section

I want to set up a Terraform module that assigns a policy to an Azure resource according to Terraforms policy …

json azure variable-assignment terraform policy
Java - comma operator outside for loop declaration

I know I can use the comma operator like this for (int i = 1, j = 15; j>10; i++, j--) { // do something …

java for-loop variable-assignment assignment-operator comma-operator