13-essential-idioms

13-essential-idioms - CS 106A Handout #13 June 30, 2009...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #13 CS 106A June 30, 2009 Essential Idioms Although today’s discussion of expressions extends to the detail level, it is important to keep in mind that instincts for programming will be sharpened much more effectively if you pay attention to the more holistic side, concentrating on learning the idioms and patterns that implement particular problem-solving strategies. These idioms give you a considerable amount of power without requiring you to learn too many of their component details. This section summarizes the most important idioms, each of which is covered in more detail in Chapter 2, 3, or 4. The first set of idioms involves getting data in and out of the computer, which provide the necessary support for the input and output phases of a typical programming task. The idioms you use depend on the type of value, as shown in the following table: Type Declaration Input idiom Integer int var = value ; var = readInt(" prompt "); Floating-point double var = value ; var = readDouble("
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/14/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Ask a homework question - tutors are online