Idiom #43 Break outer loop
Look for a negative value v in 2D integer matrix m. Print it and stop searching.
Idiom #48 Multi-line string literal
Assign to variable s a string literal consisting of several lines of text, including newlines.
Idiom #71 Echo program implementation
Basic implementation of the Echo program: Print all arguments except the program name, separated by space, followed by newline.
Skip the first argument if necessary, concatenate arguments as strings, append newline and print it to stdout.
Idiom #135 Remove item from list, by its value
Remove at most 1 item from list items, having the value x.
This will alter the original list or return a new list, depending on which is more idiomatic.
If there are several occurrences of x in items, remove only one of them. If x is absent, keep items unchanged.
Idiom #136 Remove all occurrences of a value from a list
Remove all occurrences of the value x from list items.
This will alter the original list or return a new list, depending on which is more idiomatic.
Idiom #47 Extract string suffix
Create string t consisting in the 5 last characters of string s.
Make sure that multibyte characters are properly handled.
Idiom #252 Conditional assignment
Assign to the variable x the string value "a" if calling the function condition returns true, or the value "b" otherwise.
Idiom #1 Print Hello World
Print a literal string on standard output
Idiom #2 Print Hello 10 times
Loop to execute some code a constant number of times
- Ada
- C
- Caml
- Clojure
- Cobol
- C++
- C++
- C++
- C#
- C#
- C#
- D
- D
- Dart
- Dart
- Elixir
- Erlang
- Fortran
- Go
- Go
- Go
- Groovy
- Haskell
- JS
- JS
- JS
- JS
- Java
- Java
- Java
- Java
- Java
- Java
- Java
- Kotlin
- Kotlin
- Kotlin
- Lisp
- Lua
- Lua
- Lua
- Lua
- Obj-C
- PHP
- PHP
- Pascal
- Perl
- Perl
- Perl
- Prolog
- Python
- Python
- Python
- Python
- Python
- Python
- Ruby
- Ruby
- Ruby
- Rust
- Rust
- Scala
- Scala
- Scheme
- Scheme
- Scheme
- Smalltalk
- Smalltalk
- VB
Idiom #3 Create a procedure
Like a function which doesn't return any value, thus has only side effects (e.g. Print to standard output)
Idiom #4 Create a function
Create a function which returns the square of an integer
Idiom #5 Create a 2D Point data structure
Declare a container type for two floating-point numbers x and y
- Ada
- C
- Caml
- Clojure
- Clojure
- C++
- C++
- C++
- C++
- C#
- C#
- C#
- D
- D
- Dart
- Dart
- Elixir
- Elixir
- Erlang
- Erlang
- Erlang
- Fortran
- Fortran
- Go
- Groovy
- Haskell
- Haskell
- JS
- JS
- Java
- Java
- Java
- Java
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- Pascal
- Perl
- Perl
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Python
- Ruby
- Rust
- Rust
- Scala
- Scheme
- Smalltalk
- Smalltalk
- VB
Idiom #6 Iterate over list values
Do something with each item x of the list (or array) items, regardless indexes.
- Ada
- C
- C
- Caml
- Clojure
- Cobol
- C++
- C#
- D
- D
- Dart
- Elixir
- Elixir
- Erlang
- Erlang
- Fortran
- Go
- Groovy
- Groovy
- Groovy
- Haskell
- JS
- JS
- JS
- JS
- JS
- Java
- Java
- Java
- Java
- Java
- Java
- Kotlin
- Kotlin
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- PHP
- Pascal
- Perl
- Perl
- Python
- Python
- Python
- Ruby
- Ruby
- Rust
- Rust
- Scala
- Scala
- Scala
- Scheme
- Scheme
- Scheme
- Smalltalk
- Smalltalk
- VB