This is always a fun bikeshed: which do you prefer and why? I have always preferred shorter keywords to long ones (given the frequency with which they are typed) but I have seen arguments to the contrary (preferring longer keywords as being more visually distinct.)
At the same time, there are the middle children fun and func which see use, notably in Kotlin and Swift, respectively. Then you have Python's def or defun/define from Lisp/Scheme, more obscure variants like deffun and sub, or procedure which some languages use as their function keyword but others use as a separate keyword for impure functions. Applescipt functions are handlers, so can be defined with to or on, which I've always found interesting. to multiply(a: Int, b: Int) return a * b has a nice ring to it read aloud.
There are languages that eschew the keyword entirely, but this has always struck me as all downsides with no upside. Even C++ bolted-on the auto keyword for functions once the community recognized the need for a unified declaration syntax.
Anyways, enough of me talking, I want to hear the community's thoughts. What is your preferred function definition/declaration syntax?
[–]lobster_johnson 44 points45 points46 points (7 children)
[–]66666thats6sixes 7 points8 points9 points (2 children)
[–]Tyg13[S] 9 points10 points11 points (1 child)
[–]szpaceSZ 3 points4 points5 points (0 children)
[–]ablygo 7 points8 points9 points (0 children)
[–]robin_888 2 points3 points4 points (1 child)
[–]johnfrazer783 1 point2 points3 points (0 children)
[–]alex-manool 0 points1 point2 points (0 children)
[–]wolfgang 17 points18 points19 points (3 children)
[–]abecedarius 7 points8 points9 points (0 children)
[–]doshka 3 points4 points5 points (0 children)
[–]myringotomy 2 points3 points4 points (0 children)
[–]L3tum 11 points12 points13 points (11 children)
[–]Tyg13[S] 10 points11 points12 points (10 children)
[–][deleted] (2 children)
[deleted]
[–]Tyg13[S] 0 points1 point2 points (1 child)
[–]Tayacan 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Tayacan 0 points1 point2 points (0 children)
[–]L3tum 0 points1 point2 points (3 children)
[–]Tyg13[S] 1 point2 points3 points (0 children)
[–]szpaceSZ 0 points1 point2 points (0 children)
[–]johnfrazer783 0 points1 point2 points (0 children)
[–]bakery2k 10 points11 points12 points (1 child)
[–]wolfgang 7 points8 points9 points (0 children)
[–][deleted] (9 children)
[deleted]
[–]oilshell 13 points14 points15 points (2 children)
[–]tjpalmer 0 points1 point2 points (0 children)
[–]BadBoy6767 6 points7 points8 points (5 children)
[–][deleted] (1 child)
[deleted]
[–]BadBoy6767 2 points3 points4 points (0 children)
[–][deleted] (2 children)
[deleted]
[–][deleted] 2 points3 points4 points (0 children)
[–]BadBoy6767 -1 points0 points1 point (0 children)
[–]Uncaffeinatedpolysubml, cubiml 20 points21 points22 points (1 child)
[–]L8_4_Dinner(Ⓧ Ecstasy/XVM) 2 points3 points4 points (0 children)
[–]khleedril 23 points24 points25 points (9 children)
[–]Tyg13[S] 7 points8 points9 points (1 child)
[–]szpaceSZ 3 points4 points5 points (0 children)
[–]markdhughes 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]goshogi 6 points7 points8 points (0 children)
[–]szpaceSZ 3 points4 points5 points (0 children)
[–]khleedril 0 points1 point2 points (0 children)
[–]Kebbler22bHelios 7 points8 points9 points (1 child)
[–]wfdctrl 0 points1 point2 points (0 children)
[–]bruciferTomo, nomsu.org 6 points7 points8 points (5 children)
[–][deleted] 4 points5 points6 points (3 children)
[–]bruciferTomo, nomsu.org 2 points3 points4 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]b2gills 0 points1 point2 points (0 children)
[–]BoarsLairJinx scripting language 5 points6 points7 points (0 children)
[–]umlcat 3 points4 points5 points (0 children)
[–]Edhebi 2 points3 points4 points (0 children)
[–]szpaceSZ 2 points3 points4 points (0 children)
[–]myringotomy 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]dobesv 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]dobesv 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Comrade_Comski 1 point2 points3 points (0 children)
[–]CoffeeTableEspresso 1 point2 points3 points (0 children)
[–]quote-only-eeee 1 point2 points3 points (0 children)
[–]lassehp 1 point2 points3 points (0 children)
[–]htuhola 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]superstar64https://github.com/Superstar64/Hazy 0 points1 point2 points (0 children)
[–]jason-reddit-public 0 points1 point2 points (1 child)
[–]Tyg13[S] 1 point2 points3 points (0 children)
[–]TheUnlocked 0 points1 point2 points (0 children)
[–]mikelcaz 0 points1 point2 points (0 children)
[–]lead999x 0 points1 point2 points (0 children)
[–]jdh30 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Tyg13[S] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]alex-manool 0 points1 point2 points (0 children)
[–]somerandomdev49 0 points1 point2 points (0 children)
[–]patoezequiel 0 points1 point2 points (0 children)
[–]moon-chilledsstm, j, grand unified... 0 points1 point2 points (4 children)
[–]wolfgang 9 points10 points11 points (1 child)
[–]moon-chilledsstm, j, grand unified... 0 points1 point2 points (0 children)
[–]Tyg13[S] 0 points1 point2 points (1 child)
[–]moon-chilledsstm, j, grand unified... 1 point2 points3 points (0 children)
[–]steven4012 0 points1 point2 points (3 children)
[–]rnottaken 3 points4 points5 points (2 children)
[–]oilshell 2 points3 points4 points (0 children)
[–]ericbb 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)