C++11
struct info_type
{
std::string name;
int age;
float height;
// we define an overload of operator>> as a friend function which
// gives in privileged access to private data members
friend std::istream& operator>>(std::istream& is, info_...
Comparison operators compare two values and return to you a boolean (True or False) as the result.
Equality
The equal sign = is used both for equality comparison and assignment.
If leftValue = rightValue Then ...
Inequality
The left angle bracket nest to the right angle bracket <> p...
There is a single assignment operator in VB.
The equal sign = is used both for equality comparison and assignment.
Dim value = 5
Notes
Watch out for assignment vs. equality comparison.
Dim result = leftValue = rightValue
In this example you can see the equal sign being used as both a c...
If you have the following variables
Dim leftValue As Integer = 5
Dim rightValue As Integer = 2
Dim value As Integer = 0
Addition
Performed by the plus sign +.
value = leftValue + rightValue
'Output the following:
'7
Subtraction
Performed by the minus sign -.
value = leftValue - rig...
//iterates over a map, getting the key and value at once
var map = hashMapOf(1 to "foo", 2 to "bar", 3 to "baz")
for ((key, value) in map) {
println("Map[$key] = $value")
}
stdcall is used for 32-bit Windows API calls.
Parameters
Parameters are passed on the stack, with the first parameter closest to the top of the stack. The callee will pop these values off of the stack before returning.
Return Value
Scalar return values are placed in EAX.
Saved and Clobbered Re...
// Get the battery API
navigator.getBattery().then(function(battery) {
// Battery level is between 0 and 1, so we multiply it by 100 to get in percents
console.log("Battery level: " + battery.level * 100 + "%");
});
// Get the battery API
navigator.getBattery().then(function(battery) {
if (battery.charging) {
console.log("Battery is charging");
} else {
console.log("Battery is discharging");
}
});
// Get the battery API
navigator.getBattery().then(function(battery) {
console.log( "Battery will drain in ", battery.dischargingTime, " seconds" );
});
// Get the battery API
navigator.getBattery().then(function(battery) {
console.log( "Battery will get fully charged in ", battery.chargingTime, " seconds" );
});
The method PrintWriter.format (called through System.out.format) can be used to print aligned strings in console. The method receives a String with the format information and a series of objects to format:
String rowsStrings[] = new String[] {"1",
&q...
This inserts a json dictionary where one of the members is an array of strings into the table that was created in another example.
INSERT INTO myjson(dict)
VALUES('{"opening":"Sicilian","variations":["pelikan","dragon","najdorf"]}');
...