What is the difference between Coroutines and Function?

The difference between coroutines and function

is that "coroutines" is a piece of code that performs a task, and that can be passed new input and return output more than once and "function" is what something does or is used for.

coroutines

function

Noun

  • (programming) A piece of code that performs a task, and that can be passed new input and return output more than once.

Hyponyms

  • subroutine (A coroutine that accepts input once and returns output once)
  • generator (A coroutine that accepts input once, but yields output multiple times)

Exemple

  • Although a powerful tool, coroutines can be hard to understand due to the way data can flow back and forth between sections of the code.

Noun

  • What something does or is used for.
  • A professional or official position.
  • An official or social occasion.
  • Something which is dependent on or stems from another thing; a result or concomitant.
  • A relation where one thing is dependent on another for its existence, value, or significance.
  • (mathematics) A relation in which each element of the domain is associated with exactly one element of the codomain.
  • (computing) A routine that receives zero or more arguments and may return a result.
  • (biology) The physiological activity of an organ or body part.
  • (chemistry) The characteristic behavior of a chemical compound.
  • (anthropology) The role of a social practice in the continued existence of the group.

Hyponyms

  • subfunction

Related terms

  • functor
  • fungible

Examples

  • Many genes with reproductive roles also have antibacterial and immune functions, which indicate that the threat of microbial attack on the sperm or egg may be a major influence on rapid evolution during reproduction.
  • Synonyms: aim, intention, purpose, role, use
  • Synonyms: occupation, office, part, role
  • Synonyms: affair, occasion, social occasion, social function
  • Though most of the cases here cover European encounters with non-Europeans, it is not the intention of the book to give the impression that genocide is a function of European colonialism and imperialism alone.
  • Synonyms: map, mapping, mathematical function, operator, transformation
  • Hypernym: relation
  • Synonyms: procedure, routine, subprogram, subroutine, func, funct

Verb

  • (intransitive) To have a function.
  • (intransitive) To carry out a function; to be in action.

Related terms

  • functional
  • dysfunction, dysfunctional

Examples

  • Synonyms: officiate, serve
  • Synonyms: go, operate, run, work
  • Antonym: malfunction