Linked Questions

7 votes
3 answers

When submitting a function, can global variables be declared outside the function? [duplicate]

1. When submitting a function, can global variables be declared outside the function? For example, if I have the C code f(n){int a,b,c=4;dosomething;} am I ...
Level River St's user avatar
0 votes
0 answers

Function and Code [duplicate]

Is it allowed to have an answer which has some code outside of a function? For example, in Python, if you were to get the sum of two square roots, would this be allowed: ...
nedla2004's user avatar
  • 521
28 votes
3 answers

Do function submissions have to be reusable?

Simple question: if I answer a code golf with a function (for a task which is supposed to terminate), does the function actually have to be reusable? Or could it, say, modify some globals which break ...
Martin Ender's user avatar
24 votes
3 answers

Should submissions be allowed to exit with an error?

Suppose we have the following Python code: f=lambda x:x*2 X The first line defines a function which doubles a number. Then the second line is reached, is found ...
Sp3000's user avatar
  • 61.7k
25 votes
3 answers

On scoring builtin functions

Suppose there's a challenge which can be solved completely by a builtin function, and functions are allowed. Note that as of writing the standard loophole for builtins is heavily disputed, but let's ...
Sp3000's user avatar
  • 61.7k
13 votes
2 answers

Unnamed Functions in Code Golf

For many code golf questions, we allow functions as answers. What exactly does it mean for some code to be a valid submission as a function? This question came up during a discussion on built-ins, ...
isaacg's user avatar
  • 42k
11 votes
1 answer

Functions throwing exceptions: an exception to the rules?

I'm seeking greater clarity around whether we currently allow functions to throw exceptions, and if so, under what circumstances. There seem to be contradictory posts on this topic—several highly ...
Dingus's user avatar
  • 10.9k
5 votes
1 answer

Zsh: Functions and Math functions

I have been using functions for Zsh submissions for some time. I typically submit the body alone, as the body can be run as a full program with no modification: ...
GammaFunction's user avatar
7 votes
0 answers

Does code need to be 100% syntactically correct? [duplicate]

I've come across the following answer in a code-golf challenge in Haskell, where one has to provide a function: <bindings> <expression> Now, the last ...
Zeta's user avatar
  • 701
1 vote
0 answers

Function not that directly used allowed? [duplicate]

In this answer, the function is defined as With(Math)f=(a,b,c,d)=>... (1) However, f is not used in the function, so it ...
l4m2's user avatar
  • 20.5k