; Function Example ; ---------------- ; Call our damage function for two different attacks Print "The goblin swings a rusty sword ..." Print " Damage dealt: "+Damage(6,8) Print "The knight swings an enchanted axe ..." Print " Damage dealt: "+Damage(25,8) Print "" Print "Press any key to close the example" WaitKey End ; Function defines a reusable routine - it only runs when called. ; The values passed in arrive as the parameters base and armour. Function Damage(base,armour) ; Armour soaks up part of the blow, but a hit always deals at least 1 If base<=armour Then Return 1 Return base-armour End Function