simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

count.md (758B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function count
      4 
      5 Count the number of elements of a matrix, array or string.
      6 
      7 
      8 ## Syntax
      9 
     10 ```js
     11 math.count(x)
     12 ```
     13 
     14 ### Parameters
     15 
     16 Parameter | Type | Description
     17 --------- | ---- | -----------
     18 `x` | string &#124; Array &#124; Matrix | A matrix or string
     19 
     20 ### Returns
     21 
     22 Type | Description
     23 ---- | -----------
     24 number | An integer with the elements in `x`.
     25 
     26 
     27 ### Throws
     28 
     29 Type | Description
     30 ---- | -----------
     31 
     32 
     33 ## Examples
     34 
     35 ```js
     36 math.count('hello world')        // returns 11
     37 const A = [[1, 2, 3], [4, 5, 6]]
     38 math.count(A)                    // returns 6
     39 math.count(math.range(1,6))      // returns 5
     40 ```
     41 
     42 
     43 ## See also
     44 
     45 [size](size.md)