Answers for "what is a function"

3

function

function factorial(n) {
  if (n == 0) {
    return 1;
  } else {
    return factorial(n - 1) * n;
  }
}
Posted by: Guest on July-11-2021
5

functions

A function is a reusable set of statements to perform a task or calculate a value.
Functions can be passed one or more values and can return a value at the end of their execution. 
In order to use a function, you must define it somewhere in the scope where you wish to call it.
Posted by: Guest on June-23-2020
7

function

funcion name_of_funtion(){

}
Posted by: Guest on May-04-2021
1

function

function linearSearch(value, list) {
    let found = false;
    let position = -1;
    let index = 0;
 
    while(!found && index < list.length) {
        if(list[index] == value) {
            found = true;
            position = index;
        } else {
            index += 1;
        }
    }
    return position;
}
Posted by: Guest on June-11-2020
1

function

function list_formation(){
$args = array(,

    'post_type' => 'categories',
    'posts_per_page' => 20,
);

$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    
    $formations = get_posts(array(
        'post_type' => 'formations',
        'post__in' => array(16061),
        'meta_query' => array(
            array(
                'key' => 'categories', // name of custom field
                'value' => '"' . get_the_ID() . '"', 
                'compare' => 'LIKE'
            )
        )
    ));
   
    if($formations){

        foreach ($formations as $categorie){
           // $list = get_field('formations', $formation->ID);
           // list of categorie  with ID  formation
            echo   the_title()  . '</br>';

        }

    }
endwhile;

wp_reset_postdata();
Posted by: Guest on May-14-2021
0

what is a function

def the_name(attributes):
	#a tab
    print("Hi")
    #take the attributes
    print(attributes)
#call the function
the_name("Hello")
#right the name and an attribute for attributes so it can print something
Posted by: Guest on August-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language