Optional Parameters
Posted: Tue Sep 04, 2012 7:54 pm
Brain cramp. What's the syntax for optional parameters? I can't seem to find it despite my searching. This doesn't compile:
I've been writing code all day so maybe I just need another pair of eyes.
#Cobra svn:2790 (post 0.8) / 2012-09-01 on Mono 2.10.8.1 CLR v4.0.30319 on Ubuntu 12.04.1 LTS
class PrintDefault
def main
.foo
.foo(false)
def foo(bar=true)
print "[bar]"
- Code: Select all
error: Expecting COMMA, but got "=" (ASSIGN) instead.
I've been writing code all day so maybe I just need another pair of eyes.