Function

From Objective Mathematics
Revision as of 03:16, 20 January 2024 by Lfox (talk | contribs) (Created page with "A '''function''' is a machine that takes in one thing and spits out another. [TODO gross definition] == Examples == The following lines of C++ code are a function string reverseString(const string &s) { string returnStr = ""; for (int i = s.size() - 1; i >= 0; --i) { returnStr.append(s[I]); } return returnStr; }")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A function is a machine that takes in one thing and spits out another. [TODO gross definition]

Examples

The following lines of C++ code are a function

string reverseString(const string &s) { 
  string returnStr = ""; 
  for (int i = s.size() - 1; i >= 0; --i) { 
    returnStr.append(s[I]);
  }
  return returnStr;
}