What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-18 12:54:35
stack overflow python array
# empty array arr = [] # init with values (can contain mixed types) arr = [1, "eels"] # get item by index (can be negative to access end of array) arr = [1, 2, 3, 4, 5, 6] arr[0] # 1 arr[-1] # 6 # get length length = len(arr) # supports ap... Add solution -
Ruby 2021-11-14 12:17:24
ruby .first
# Returns the first element, or the first n elements, of the array. # If the array is empty, the first form returns nil, # and the second form returns an empty array. a = [ "q", "r", "s", "t" ] a.first #=> &... Add solution -
Javascript 2021-11-10 00:21:16
javascript dynamic arrays
var input = []; // initialise an empty array var temp = ''; do { temp = prompt("Enter a number. Press cancel or leave empty to finish."); if (temp === "" || temp === null) { break; } else { input.push(temp);... Add solution -
PHP 2021-11-05 09:28:08
Convert String to Float in PHP
$stringVal = "12.06"; $stringConvertedToFloat = floatval( $stringVal ); // The floatval function will return the argument converted // to a float value if the value can be converted. // IF the value cannot be converted these are the values that ... Add solution -
Java 2021-10-28 05:59:12
ArrayList remove(Object o) method in java
import java.util.ArrayList; public class ArrayListRemoveObjectExample { public static void main(String[] args) { // create an empty ArrayList ArrayList<String> names = new ArrayList<String>(7); names.add("Bharat&qu... Add solution -
Java 2021-10-23 21:35:11
java insert element at position
package com.tutorialspoint; import java.util.ArrayList; public class ArrayListDemo { public static void main(String[] args) { // create an empty array list with an initial capacity ArrayList<Integer> arrlist = new ArrayList<Inte... Add solution -
Javascript 2021-10-17 19:22:03
react responsive screen size
const MyComponent = () => { // Declare a new state variable with the "useState" Hook const [width, setWidth] = React.useState(window.innerWidth); const breakpoint = 620; React.useEffect(() => { /* Inside of a "useEffect&q... Add solution