- The snippets are under the CC-BY-SA license.
- Please consider keeping a bookmark
- (instead of printing)
Cobol | |||
---|---|---|---|
1 |
Print a literal string on standard output
|
||
2 |
Loop to execute some code a constant number of times
|
||
6 |
Do something with each item x of the list (or array) items, regardless indexes.
|
||
21 |
Swap the values of the variables a and b
|
||
41 |
Create the string t containing the same characters as the string s, in reverse order.
The original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory. |
||
46 |
Create the string t consisting of the 5 first characters of the string s.
Make sure that multibyte characters are properly handled. |
||
47 |
Create string t consisting in the 5 last characters of string s.
Make sure that multibyte characters are properly handled. |
||
48 |
Assign to variable s a string literal consisting in several lines of text, including newlines.
|
|
|
50 |
Write a loop that has no end clause.
|
||
61 |
Assign to the variable d the current date/time value, in the most standard type.
|
||
78 |
Execute a block once, then execute it again as long as boolean condition c is true.
|
||
87 |
Exit immediately.
If some extra cleanup work is executed by the program runtime (not by the OS itself), describe it. |
||
96 |
Set the boolean b to true if string s starts with prefix prefix, false otherwise.
|
||
99 |
Assign to the string x the value of the fields (year, month, day) of the date d, in format YYYY-MM-DD.
|
|
|
110 |
Set the boolean blank to true if the string s is empty, or null, or contains only whitespace ; false otherwise.
|
||
120 |
Read an integer value from the standard input into the variable n
|
||
131 |
Execute f1 if condition c1 is true, or else f2 if condition c2 is true, or else f3 if condition c3 is true.
Don't evaluate a condition when a previous condition was true. |
||
169 |
Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled. n can be different from the number of bytes of s. |
||
206 |
Execute different procedures foo, bar, baz and barfl if the string str contains the name of the respective procedure. Do it in a way natural to the language.
|