A function is a block of code that will be called several times during the execution. Instead of writing the same piece of code again and again, one can write this code inside a function and call that function whenever it is needed.
A function :
Must be declared in a class or a module
Returns a...
Throughout the topics and examples here we'll see many declarations of variables, functions and so on.
As well as their name, data objects may have attributes. Covered in this topic are declaration statements like
integer, parameter :: single_kind = kind(1.)
which gives the object single_kind...
This example displays a transaction for an image view with only two images.(can use more images as well one after the other for the first and second layer positions after each transaction as a loop)
add a image array to res/values/arrays.xml
<resources>
<array
name=&...
std::optional<float> divide(float a, float b) {
if (b!=0.f) return a/b;
return {};
}
Here we return either the fraction a/b, but if it is not defined (would be infinity) we instead return the empty optional.
A more complex case:
template<class Range, class Pred>
auto find_if...
You can call a Clojure function from Java code by looking up the function and invoking it:
IFn times = Clojure.var("clojure.core", "*");
times.invoke(2, 2);
This looks up the * function from the clojure.core namespace and invokes it with the arguments 2 & 2.
The macro() function allows you to add new functionality to Illuminate\Support\Collection objects
Usage:
Collection::macro("macro_name", function ($parameters) {
// Your macro
});
For example:
Collection::macro('uppercase', function () {
return $this->map(function ($i...
The permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers.
If this method is called without a block, it will return an enumerator. To convert to an array, call the to_a method.
ExampleResult[1,2,3].permutation#<...
DatabaseTransactions trait allows databases to rollback all the change during the tests. If you want to rollback multiple databases , you need to set $connectionsToTransact properties
use Illuminate\Foundation\Testing\DatabaseMigrations;
class ExampleTest extends TestCase
{
use Databas...
function processGoogleDriveFolders() {
var arrayAllFolderNames,continuationToken,folders,foldersFromToken,thisFolder;//Declare variable names
arrayAllFolderNames = [];//Create an empty array and assign it to this variable name
folders = DriveApp.getFolders();//Get all folders from ...
function processGoogleDriveFiles() {
var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names
arrayAllFileNames = [];//Create an empty array and assign it to this variable name
files = DriveApp.getFiles();//Get all files from Googl...
Visual Studio also features an available Bundler and Minifier Extension that is capable of handling this process for you. The extension allows you to easily select and bundle the files you need without writing a line of code.
Building Your Bundles
After installing the extension, you select all of ...
At its most basic level, Unit Testing in any language provides assertions against some known or expected output.
function assert( outcome, description ) {
var passFail = outcome ? 'pass' : 'fail';
console.log(passFail, ': ', description);
return outcome;
};
The popular assertio...
Elm allows the definition of custom infix operators.
Infix operators are defined using parenthesis around the name of a function.
Consider this example of infix operator for construction Tuples 1 => True -- (1, True):
(=>) : a -> b -> ( a, b )
(=>) a b =
( a, b )
Most of t...
The minification is used to reduce the size of CSS and Javascript files to speed up download times. This process is done by removing all of the unnecessary white-space, comments, and any other non-essential content from the files.
This process is done automatically when using a ScriptBundle or a St...
This is an example of something that would have been straight up impossible with labels. If you execute the same label multiple times at the same time and they rely on variables that are being defined within them, they very likely interfere and cause unexpected behavior.
Here is how to do it with f...
When you are programming in OpenGL or any other graphics api you will hit a brick wall when you are not that good in math. Here I will explain with example code how you can achieve movement/scaling and many other cool stuff with your 3d object.
Let's take a real life case... You've made a awesome (...