January 2013
Beginner to intermediate
624 pages
17h 18m
English
Now that we have the ability to store and compile our code, we can begin to write more advanced functions. The functions that we have written so far are extremely simple and a bit underwhelming. Now let’s get to more interesting stuff. In this chapter, we’ll work with functions that behave differently depending on the arguments passed to them and expressions that let us make decisions based on different conditions.
The first function we’ll write will greet someone differently according to gender. To achieve this in most procedural languages, you would need to write something similar to the following pseudocode:
function greet(Gender,Name) if Gender == male then print("Hello, Mr. %s!", Name) else if ...Read now
Unlock full access