https://github.com/jrincayc/ucblogo-code
Revision 5d18e80864eb0edade94c46f6e180952129f0f25 authored by Joshua J. Cogliati on 28 December 2020, 17:31:21 UTC, committed by Joshua J. Cogliati on 28 December 2020, 17:31:21 UTC
2 parent s 707422d + d8fc446
Raw File
Tip revision: 5d18e80864eb0edade94c46f6e180952129f0f25 authored by Joshua J. Cogliati on 28 December 2020, 17:31:21 UTC
Merge remote-tracking branch 'origin/master' into release_6_2_work
Tip revision: 5d18e80
cond
COND clauses						(library procedure)

	command or operation.  The input is a list of lists (clauses); each
	clause is a list whose first element is either an expression whose
	value is TRUE or FALSE, or the word ELSE, and whose butfirst is a Logo
	expression or instruction.  COND examines the clauses in order.  If a
	clause begins with the word ELSE (upper or lower case), then the
	butfirst of that clause is evaluated and CASE outputs its value, if
	any.  Otherwise, the first element of the clause is evaluated; the
	resulting value must be TRUE or FALSE.  If it's TRUE, then the
	butfirst of that clause is evaluated and COND outputs its value, if
	any.  If the value is FALSE, then COND goes on to the next clause.  If
	no clause is satisfied, COND does nothing.  Example:

		to evens :numbers	; select even numbers from a list
		op cond [ [[emptyp :numbers] []]
		          [[evenp first :numbers]  ; assuming EVENP is defined
		           fput first :numbers evens butfirst :numbers]
		          [else evens butfirst :numbers] ]
		end


back to top