Skip to content

Instantly share code, notes, and snippets.

@coderodde
Last active February 25, 2024 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderodde/4c0f448d6c15e24055e9d732ecbf38a7 to your computer and use it in GitHub Desktop.
Save coderodde/4c0f448d6c15e24055e9d732ecbf38a7 to your computer and use it in GitHub Desktop.
int, double (ret_int, ret_double) my_foo(a, b, c):
if specified a:
print "a"
if specified b:
print "b"
if specified c:
print "c"
if is_requested ret_int:
print "int on return requested"
if is_requested ret_double:
print "double on return requested"
return 1, 2.0
_, ret_double = my_foo(1, _, 3):
# Returns:
# a
# c
# double on return requested
Esim. Olkoon:
double, double (r1, r2) GetStatistics(List of ints L):
mean = Null
if is_requested r1:
mean = Mean(L)
else
return _, _ # No mean, no standard deviation
if is_requested r2:
return mean, StandardDeviation(L, mean) # Return both mean and standard deviation.
return mean, _ # No standard deviation requested. Return only mean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment