<?php function writeMsg() { echo "Hello world!"; } writeMsg(); //call the function ?>
function range(start, end) { /* generate a range : [start, start+1, ..., end-1, end] */ var len = end - start + 1; var a = new Array(len); for (let i = 0; i < len; i++) a[i] = start + i; return a; }
/* Declare function */ function myFunc(param) { // Statements }
def function_name(): pass
function idk() { alert('This is an alert!') } //call the function to make the function run by saying "Name of function + ()" idk()
function MyApp() { return ( <div> <ul> <li>Name </li> <li>Place </li> <li>Animal </li> </ul> </div> ) } ReactDOM.render( <MyApp />, document.getElementById('root') );
for (statement 1; statement 2; statement 3) { // code block to be executed } var i; for (i = 0; i < cars.length; i++) { text += cars[i] + "<br>"; }