Code examples · runnable

240 runnable code examples.

Open any example to explore the code and run it online. No setup, no signup.

How to remove an item from an array in JavaScriptHow to remove a property from an object in JavaScriptHow to check if a string contains a substring in JavaScriptHow to loop through an array in JavaScriptHow to replace all occurrences of a string in JavaScriptHow to capitalize the first letter of a string in JavaScript
How to convert a string to an int in JavaHow to iterate over a map in JavaHow to convert an array to a list in JavaHow to generate a random number in a range in JavaHow to check if an array contains a value in JavaHow to initialize a list in one line in Java
How to loop through an enum in C#How to convert an int to an enum in C#How to check if a string contains a substring in C#How to iterate over a dictionary in C#How to deep clone an object in C#How to catch multiple exceptions in C#
Inner, left, right and full outer joins in SQLHow to update one table from another in SQLHow to add a column with a default value in SQLHow to find and delete duplicate rows in SQLHow to combine rows into one string in SQLHow to get only the date from a datetime in SQL
How to split a string in C++How to use smart pointers in C++How to set, clear and toggle a bit in C++How to convert an int to a string in C++How to convert a string to a char* in C++How to concatenate two vectors in C++
How to convert a string to a number in TypeScriptHow to use getters and setters in TypeScriptHow to create a dictionary in TypeScriptHow to convert a string to an enum in TypeScriptHow to type a callback function in TypeScriptHow to extend a type in TypeScript
How to remove an element from an array in PHPHow to prevent SQL injection with PDO in PHPHow to check if a string contains a substring in PHPHow to parse HTML and XML in PHPHow to check if a string starts with another string in PHPHow to sort a multidimensional array in PHP
How to loop with an index in SwiftHow to get the length of a string in SwiftHow to split a string in SwiftHow to convert a string to an int in SwiftHow to check if a string contains a substring in SwiftHow to sort an array of objects by property in Swift
How to check for null in KotlinHow to create a static method in KotlinHow to declare and initialize an array in KotlinHow to check a type at runtime in KotlinHow to initialize a list in KotlinHow to check if a lateinit variable is initialized in Kotlin
How to use a case statement in RubyHow to handle errors in RubyHow to run a shell command in RubyHow to skip to the next iteration in RubyHow to check if an array contains a value in RubyHow to use getters and setters in Ruby
Questions & answers

Examples, explained

Can I run these code examples?

Yes. Open any example to edit and run its code on the CompileBytes engine without installing anything.

Is this free? Do I need an account?

Every example is free to read, run, edit, and copy. No account is required.

Can I copy these into my own projects?

Yes. These examples are designed to be copied and adapted to your own code.

Where can I run my own code?

Open a compiler from the main playground catalog, then paste or write any code you want to run.