- The snippets are under the CC-BY-SA license.
- Please consider keeping a bookmark
- (instead of printing)
Print a literal string on standard output
Loop to execute some code a constant number of times
Like a function which doesn't return any value, thus has only side effects (e.g. Print to standard output)
Create a function which returns the square of an integer
Declare a container type for two floating-point numbers x and y
Do something with each item x of the list (or array) items, regardless indexes.
Print each index i with its value x from an array-like collection items
Create a new map object x, and provide some (key, value) pairs as initial content.
The structure must be recursive because left child and right child are binary trees too. A node has access to children nodes, but not to its parent.
Check if the list contains the value x.
list is an iterable finite container.
The structure must be recursive. A node may have zero or more children. A node has access to its children nodes, but not to its parent.
Reverse the order of the elements of the list x.
This may reverse "in-place" and destroy the original ordering.
Implement a function search which looks for item x in a 2D matrix m.
Return indices i, j of the matching cell.
Think of the most idiomatic way in the language to return the two values at the same time.
Calculate the sum s of the integer list or array x.
Declare the floating point number y and initialize it with the value of the integer x .
Create an enumerated type Suit with 4 possible values SPADES, HEARTS, DIAMONDS, CLUBS.
Create t consisting of 3 values having different types.
Explain if the elements of t are strongly typed or not.