There are named functions, but the level of modularity is the file system. Each function is in its own file and the name of the file is the name of the function.
You can't actually create your own entities, but you can summon an invincible invisible armor stand that is unaffected by gravity and tagged with a custom model, then teleport it incrementally.
There are no "if" statements, but you can put a filter on a command so it only runs for entities with certain attributes.
There are no variables, but you can add a tag to an entity so you can catch it in a filter later.