DOC PREVIEW
TRINITY CSCI 1320 - Sequential Execution and Scripts

This preview shows page 1-2-3 out of 9 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 9 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Sequential Execution and Scripts1-26-2011Opening DiscussionMinute EssaysDifficulty of the quiz.Usefulness of hex.Do I play ultimate?Types of escape characters. When to use them.Grade return times.Why both hex and octal?Meaning of A-F I hex.“Number “+8+7 is (“Number “+8)+7Need for commands.VariablesIt is very common to want to represent values with names.A variable is a name that we use to represent a value.In Scala we can declare variables using val or var.val name:Type = expressionvar name:Type = expressionA val can't change it's value, a var can.The colon and type generally optional.TuplesAnother type in Scala is the Tuple type.A tuple has comma separated values in parentheses.They give us a way to handle a fixed set of associated values.Assignment into a tuple does pattern matching.ScriptsWe have spent most of our time in the REPL entering one statement at a time.When we want to do things repeatedly it is nice to put the commands in a file called a script.We can use vi to write a script and put Scala commands in the file.We can run it by specifying the file name after the command scala.Alternately, we can load it into the REPL.Sequential ExecutionWhen you put commands into a script, they are normally executed one after the other from top to bottom.This is what we call sequential execution and it is the default way things happen.Order can be very significant for the instructions in a program.Standard InputScala provides a whole set of functions you can call to read from standard input.readInt()readDouble()readLine()And many moreThis can make your scripts far more useful as they can be used with different values each time you run them.Some ProblemsWe are still a little limited in that we can only do simple math and formatting, but let's try to do some things with that in scripts.We'll start with formatting money.Calculating hourly wages?Taking averages of grades?Suggestions?Minute EssayWhat questions do you have about things?The next IcP is


View Full Document

TRINITY CSCI 1320 - Sequential Execution and Scripts

Documents in this Course
Functions

Functions

10 pages

Functions

Functions

10 pages

Graphics

Graphics

10 pages

Graphics

Graphics

11 pages

Loops

Loops

4 pages

Loops

Loops

3 pages

Strings

Strings

9 pages

Functions

Functions

10 pages

Loops

Loops

11 pages

Graphics

Graphics

11 pages

Graphics

Graphics

12 pages

Sorting

Sorting

11 pages

Sorting

Sorting

10 pages

Arrays

Arrays

10 pages

Loops

Loops

18 pages

Load more
Download Sequential Execution and Scripts
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Sequential Execution and Scripts and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Sequential Execution and Scripts 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?