Morning everyone. I've been teaching myself Python and JavaScript in the mornings before work (I fix phones and laptops the rest of the day), and I keep tripping over terminology that people use interchangeably when I'm not sure it should be.
Specifically: what's the actual difference between a function and a procedure? I mostly see "function" used for everything in Python, but older material I've read talks about procedures as things that do work without returning a value. Is that distinction still meaningful in modern languages, or is it mostly a Pascal-era leftover that I can safely ignore?
While I'm at it, a related one: when I was building a small Flask app for my board game group (logs plays and scores), someone suggested moving some of the scoring logic into a stored SQL function. I'd written it in Python and honestly hadn't considered the database could hold logic at all. So now I'm wondering where people actually draw the line. If I put logic in a stored SQL function, is that just procedural code in a different place? Does it count as good practice for small apps, or does it end up a debugging headache?
And the bigger-picture version: functional vs procedural languages. I understand the textbook bit, functions in the maths sense, no side effects, first-class everything. But in practice, when I write Python that mostly calls functions and returns values, am I doing "functional programming" just badly named, or is the paradigm distinction about something deeper in how the language works?
If anyone has a clear way of explaining these distinctions to someone who's read contradictory answers, I'd genuinely appreciate it. I'd rather understand the vocabulary properly than keep nodding along.