More Snap



SNAP is a multi-paradigm language, meaning it incorporates several programming paradigms:
  1. Functional programming
    Evaluate an expression and use the resulting value for something.

    cascading values compose functions



  2. Imperative programming (sequential)-computation in a series of steps
    examples:Pascal and C
    First do this and next do that

    mutation is allowed.
    This is a harder way to think, harder to debug
    f(x)=(x+3)*√x
    	 ans=x
    	 ans=√ans
     	ans=(x+3)*ans
     	return ans



  3. Object-Oriented Programming (OOP)
    examples:Java, C++
    Objects as data structures
    attributes and behaviors
    easy to build massive project in a group way
    classes an instances
    inheritance

    Send messages between objects to simulate the temporal evolution of a set of real world phenomena.


  4. Declarative
    example:prolog
    You tell the system some rules and then you can question it about the rules.
    Tell you what you want, not how to do it. What is forefront. subcategories: constraint
    logic

    Answer a question via search for a solution.






new counter (this is a new instances of counter) It is a function that takes no inputs, but returns an object changes count by 1