Truly declarative language?

后端 未结 19 2196
梦毁少年i
梦毁少年i 2021-02-04 01:26

Does anyone know of a truly declarative language? The behavior I\'m looking for is kind of what Excel does, where I can define variables and formulas, and have the formula\'s re

19条回答
  •  情书的邮戳
    2021-02-04 02:09

    Here is Daniel's example in Python, since I noticed you said you tried it in Python.

    x = 10
    y = 10
    
    z = lambda: x + y
    
    # Output: 20
    print z()
    
    x = 20
    
    # Output: 30
    print z()
    

提交回复
热议问题