Starting Programming - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Starting Programming

Description:

Flex has a built-in question and answer sub-system. ... Asking a question generates a dialog box which, in the example above, awaits keyboard input. ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 31
Provided by: UFO
Category:

less

Transcript and Presenter's Notes

Title: Starting Programming


1
Starting Programming
  • From Ch.2, Flex Tutorial, by Clive Spenser, LPA.

2
2.1 First Program
  • We will start by defining a question and an
    action. The outline structure for these are

question question_name prompt text for
question input datatype because
explanation . action action_name do
directive(s) .
An example
3
2.1 First Program
question your_name Please enter your name
input name . action hullo do ask
your_name and write( 'hi there ' ) and
write( your_name ) and nl .
4
2.2 Questions and Answers
  • Flex has a built-in question and answer
    sub-system.
  • You can also generate basic questions using
    reserved words such as choose from, input etc.
  • Alternatively you can build more sophisticated
    dialogs by supplying your own code to display
    them.
  • Asking a question generates a dialog box which,
    in the example above, awaits keyboard input.
  • When you respond, the reply is stored in a
    variable which has the same name as the question,
    in this case your_name.
  • You can then refer to your_name to access
    whatever was entered.

5
2.3 Compiling and Running Queries
  • Made sure you do have a .KSL extension.
  • Use the Compile item on the Run menu to
    compile your code.
  • In the Console window, type hullo. at the ?-
    prompt and press ltreturngt.
  • You can try clicking on the Explain... button
    to see what happens.

6
2.4 Expanding the Code
question your_name Please enter your name
input name because I would like to call you
personally. action hullo1 do ask your_name
and write( 'hi there ' - your_name ) and nl.
7
2.5 Expanding the Code Further
question your_age Please enter your age
input integer forces the input to be an
integer because I would like to know how old
you are . action hullo do ask your_name
and ask your_age and write( ' Hi ' ) and
write( your_name ) picks up the name entered
and write( ' I think ' ) and write( your_age )
picks up the age entered and write( ' is
cool! ' ) and nl .
and echo( 'Hi', your_name, 'I think ', your_age,
' is cool' )
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
2.1 First Program
  • Start by defining a question and an action. The
    outline structure for these are

question question_name prompt text for question
input datatype because explanation
. action action_name do directive(s) .
25
2.1 First Program
question your_name Please enter your name
question text to be displayed input name .
forces the input to be treated
as a character string action hullo
do ask your_name and write( 'hi there ' ) and
write( your_name ) and nl . notice
and is used as a delimiter
26
2.2 Questions and Answers
  • Flex has a built-in question and answer
    sub-system. You can also generate basic questions
    using reserved words such as choose from, input
    etc.
  • Alternatively you can build more sophisticated
    dialogs by supplying your own code to display
    them.
  • Asking a question generates a dialog box which,
    in the example above, awaits keyboard input.
  • When you respond, the reply is stored in a
    variable which has the same name as the question,
    in this case your_name.
  • You can then refer to your_name to access
    whatever was entered.

27
2.2 Questions and Answers
28
2.2 Questions and Answers
29
(No Transcript)
30
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com