Skip to content
Exit presentation

Using AI Well & Safely I

A request worth keeping

Save a good request with blanks in it. Fill the blanks each time. A request with blanks is called a frame.

The frame: "Write about ___ for ___. Keep it to ___."
Step 1 of 4
  1. The frame: "Write about ___ for ___. Keep it to ___."
  2. Fill the blanks: topic, reader, length.
  3. One call builds: "Write about the water cycle..."
  4. Same frame. New values each time.

Slide each blank below. One call builds the request.

Loading lab…

The rule

A saved request is a function. Its changing parts are parameters. One call assembles the whole request. Write it so other values can fill the blanks.

The frame with blanks is a function. Each blank is a parameter. A filled value is an argument.

`` function ask(topic, who, howLong) { let text = "Write about " + topic; text = text + " for " + who + ". Keep it to "; return text + howLong + "."; } ``

Here topic is the subject and who is the reader. howLong is the length.

Take ask("the water cycle", "Class 6", "half a page"). Line 2 makes text the words Write about the water cycle. Line 3 adds for Class 6. Keep it to after them. The return line adds half a page. and hands back the whole text.

So the call gives back one readable line:

Write about the water cycle for Class 6. Keep it to half a page.

The function must return the text. Only then can the calling line use it.

Jump to lesson

This track

  1. 0 Start here
  2. 1 What you actually asked
  3. 2 Who it is for
  4. 3 Give it the material
  5. 4 Change one thing
  6. 5 Check it against the thing
  7. 6 What it cannot know
  8. 7 A request worth keeping
  9. 8 The big picture
  10. 9 Track quiz

Other tracks