# This is a pure function.
->(foo, bar) {
div {
h1 foo
p bar
}
}
# This is not a pure function.
-> {
div {
h1 "The time is:"
p Time.now.to_s
}
}
# This is not a pure function.
->(id) {
user = DB.query(
"select * from users where id = ?", id
).first
h2 "User name: #{user[:name]}"
}
# This is not a pure function.
-> {
LOGFILE.info("Rendering my awesome template...")
h2 "Oops, I just caused a side effect"
}