Documentation / LearningLemur

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • WirisQuizzes

      • LearningLemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • LearningLemur
                        • LearningLemur Reference
                        • LearningLemur glossary of commands
                        • LearningLemur glossary of commands

                        Programming functions

                        Reading time: 2min

                        This section describes core programming constructs used to build adaptive logic in LearningLemur. These commands support conditional execution, loops, random value generation, collection handling, and logical checks. They are useful for creating dynamic exercises and controlling how values and conditions are processed within a logical.

                        Tip: For practical examples showing how these programming functions are used in real exercises, see the Examples section.


                        Function Reference

                        belongs?

                        Description

                        Checks whether an element belongs to a list or vector.

                        Syntax

                        belongs?(Element, List | Vector)

                        Returns

                        true if the element is in the list or vector; otherwise false.

                        constant_list

                        Description

                        Constructs a list by repeating the same element a specified number of times.

                        Syntax

                        constant_list(Integer, Element)

                        Returns

                        A list containing the element x repeated n times.

                        else

                        Description

                        Defines the fallback branch of an if statement.

                        Returns

                        Executes the next block of code if the preceding if condition was not satisfied.

                        Notes

                        • This command must be preceded by an if statement.

                        else_if

                        Description

                        Defines an additional conditional branch after an if statement.

                        Returns

                        Executes the next block of code if the preceding if condition was not satisfied and the current condition is true.

                        Notes

                        • This command must be preceded by an if statement.

                        for

                        Description

                        Creates a loop that runs a block of code a specific number of times or over an iterator range.

                        Notes

                        • Use this command when the number of iterations is known or controlled by an iterator.

                        is?

                        Description

                        Checks whether an object belongs to a specified domain or type.

                        Syntax

                        is?(Object, Domain)

                        Returns

                        true if the object is of type D; otherwise false.

                        length

                        Description

                        Returns the length or size of an object.

                        Syntax

                        length(List | Vector | Range | Rule)

                        Returns

                        The number of elements or entries in the object.

                        list

                        Description

                        Converts a supported object into a list.

                        Syntax

                        list(Vector | Range | Permutation | Polygonal | Point | Frequency_sample_of)

                        Returns

                        A list representation of the input object.

                        max

                        Description

                        Returns the maximum value among a set of real numbers or among the elements of a list, vector, or range.

                        Syntax

                        max(Real, ..., Real)
                        max(List | Vector | Range)

                        Returns

                        The largest value in the provided inputs.

                        min

                        Description

                        Returns the minimum value among a set of real numbers or among the elements of a list, vector, or range.

                        Syntax

                        min(Real, ..., Real)
                        min(List | Vector | Range)

                        Returns

                        The smallest value in the provided inputs.

                        null?

                        Description

                        Checks whether an object is null.

                        Syntax

                        null?(Object)

                        Returns

                        true if the object is null; otherwise false.

                        prepend

                        Description

                        Adds an element to the beginning of a list or vector.

                        Syntax

                        prepend(List | Vector, Element)

                        Returns

                        A list or vector with the new element inserted at the beginning.

                        random

                        Description

                        Generates a random integer or real number within a specified interval.

                        Syntax

                        random(Integer)
                        random(Real)
                        random(Integer, Integer)
                        random(Real, Real)

                        Returns

                        With one integer n, returns a random integer in [0,n) if n > 0, or in (n,0] if n < 0.
                        With one real x, returns a random real in [0,x) if x > 0, or in (x,0] if x < 0.
                        With two integers a and b, returns a random integer in [a,b].
                        With two reals a and b, returns a random real in [a,b].

                        repeat

                        Description

                        Repeatedly executes the next block of code until a condition becomes true.

                        Notes

                        • Use this command when the stopping condition is checked after repeated execution.

                        sort

                        Description

                        Sorts a list, range, or vector in ascending order.

                        Returns

                        A sorted version of the input collection.

                        subset?

                        Description

                        Checks whether one list or vector is a subset of another.

                        Syntax

                        subset?(List | Vector, List | Vector)

                        Returns

                        true if A is a subset of B; otherwise false.

                        where

                        Description

                        Specifies a condition that must be satisfied.

                        Notes

                        • This command works together with in.

                        while

                        Description

                        Executes the next block of code while a condition remains true.

                        Notes

                        • This is the standard looping construct for condition-controlled repetition.

                        with

                        Description

                        Specifies the range of an iterator.

                        Notes

                        • This command is commonly used together with iteration constructs such as for.

                        Was this article helpful?

                        Yes
                        No
                        Give feedback about this article

                        Related Articles

                        • Functions
                        • User functions
                        • Integrate

                        Programming functions

                        Function Reference belongs? constant_list else else_if for is? length list max min null? prepend random repeat sort subset? where while with

                        Making people’s STEM work more meaningful

                        MathType

                        • MathType for Office Tools
                        • MathType for Mac
                        • MathType for Microsoft 365
                        • MathType for Google Workspace
                        • MathType for LMS
                        • MathType for XML Editors
                        • Arabic notation
                        • Our products accessibility
                        • MathType is online

                        WirisQuizzes

                        Learning Lemur

                        Solutions for Education

                        • Blackboard Learn
                        • Brightspace by D2L
                        • Canvas
                        • Google Classroom
                        • Moodle
                        • Schoology

                        Solutions for Publishing Houses

                        Solutions for Technical Writers

                        Solutions for Chemistry

                        Integrations

                        • HTML Editors
                        • MathType in WordPress

                        Pricing

                        Company

                        Careers

                        Blog

                        Contact Us

                        Buy Now

                        Plugin Downloads

                        © Wiris 2025

                        • Cookie Settings
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Powered by Helpjuice
                        Expand