Although there are some ideas on what data-based programming is, let me give you an example using a data structure and function.
Example without data:
data_lloyd = {'name': 'Lloyd', 'lives': 'Alcoy } data_jason = {'name': 'Jason', 'lives': 'London' } go = function(x) if x.name == 'Lloyd' then print("Alcoy, Spain") else print("London, UK") end
Data example:
data_lloyd = {'name': 'Lloyd', 'lives': function(){ print("Alcoy, Spain") } data_jason = {'name': 'Jason', 'lives': function(){ print("London, UK") } go = function(x) x.lives() end
In the first example, the decision is to show one result or another in the logic of the code. In the last example, the output is determined by the data that is passed to the function, and for this reason we say that the result is βdrivenβ by the data.
Lloyd Moore Jun 06 2018-11-11T00: 00Z
source share