"Let me tell you about commands (statements) and code blocks. This is really simple stuff. A method body consists of commands, or statements. Each command ends in a semicolon."
Examples of commands: | |
---|---|
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
"A code block consists of several commands combined using curly brackets. A method body is a code block."
Examples: | |
---|---|
1 |
|
2 |
|
3 |
|
4 |
|
"The following rule is valid in almost any situation: wherever you can write one command, you can also write a code block. We will see examples of this in subsequent tasks."