We can iterate an Array / list in ruby in two ways:
Using the for x in y syntax:
> for x in [1,2,3] do
> puts x
> end
1
2
3
=> [1, 2, 3]
Using the method .each
> [1,2,3].each do |x|
> puts x...
Some time ago, due to an accident at the time of a debug I realized that PHP is not case sensitive at the time of a function call.
Example:
print_r($teste);
print_R($teste);
Print_R($teste);
The same thing happens for the methods of...
My teacher introduced this role to us:
void escala(std::vector<double> &v, double fator)
{
for (auto &vi:v){
vi *= fator;
}
}
It serves to multiply all elements of a vector by an already predefined factor.
I h...
In the response code this question in SOen I found an unfamiliar statement line in C #. I tested this line and it works, but I did not understand the meaning of this @ character behind the member name.
// declara "@foo" como uma strin...
I have doubts about using the colon :: , used to do class implementation, [tipo] [classe]::[método] . It is also used, for example, in std::cout . What exactly would these two double points be and what do they serve for?
The comma is what? Just a construction of language? An operator? Why does it exist?
This question is based on what you saw in Returning or extracting more than one value from a function? .
return base2, base3, base4
I know you can do this:
int a[5] = { 0, 3, 8, 0, 5 };
or
int a[5];
a[1] = 3;
a[2] = 8;
a[4] = 5;
Can you do the same in just one line, already in the definition?
In PHP, variables usually have a pattern to follow in their declaration.
According to the manual:
Variables in PHP are represented by a dollar sign ($) followed by
variable name. The variable names in PHP distinguish between
upperca...
When reading a tutorial on Entity Framework, I came across an example code where there was a line that, for me, is unknown:
Student stud = new Student() { StudentName = "New Student" };
I understand that a new object of type Student...