Functions


Warning: mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO) in /home/frelaen/webapps/robofontdoc/wp-content/plugins/github-code-viewer-2/GitHub_Code_Viewer.php on line 116

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/frelaen/webapps/robofontdoc/wp-content/plugins/github-code-viewer-2/GitHub_Code_Viewer.php on line 116

# Functions

# a repeated action can be bundled into a single function

def myFunction():
    print "hello"
    
myFunction()
myFunction()

# arguments can be passed along

def myMathFunction(number):
    print number * 6

myMathFunction(9)
myMathFunction(60)


# function can also return a value

def myReturningFunction(number):
    return number * 6

print myReturningFunction(9)    # prints 54
print myReturningFunction(60)   # prints 360 

# compare
print myMathFunction(60)        # will print None, 
                                # cause the function is not returning anything

Open this script in RoboFont.