Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [doubleNumber] = doubleIt(x)
- %Function: doubleIt
- %Input: x, a number
- %Output: doubleNumber, a number
- %Purpose: Takes an input number (x), multiplies it by 2, stores it as
- %doubleNumber and returns the number to the user
- %Use: From command prompt you type 'doubleIt(x)' where x is a number
- %Example: doubleIt(8) returns 16
- doubleNumber = 2*x; %Notice that 'x' is never actually defined in the function,
- %it is 'passed' to the function
- %doubleNumber is the variable 'returned' by the fuction
- %It is automatically returned based on the first line of the function
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement