English subtitles

← Inc Procedure - Intro to Computer Science

Get Embed Code
9 Languages

Showing Revision 6 created 05/25/2016 by Udacity Robot.

  1. So, for our first question about procedures,
  2. The question is, "What does the 'inc' procedure defined below do?"
  3. And here's the code for defining 'inc.'
  4. We're going to define the procedure that takes one input;
  5. we'll call that input "n,"
  6. and we are going to have our return statement
  7. where the expression following the return is "n+1."
  8. So what does this procedure do?
  9. The choices are: Nothing.
  10. It takes a number as its input, and outputs that number plus one.
  11. It takes a number as input, and outputs the same number.
  12. Or--the final choice--it takes two numbers as inputs,
  13. and outputs the sum of those two numbers.