Humanities Home page   Office of Digital Humanities
Back     BYU LiveCode Lessons Gateway

CHum 310
Reviewing Programming Concepts and Control Structures

For this activity you will create a stack and create some simple scripting that will give you a chance to review some of the fundamental concepts of programming.

  1. Create a new mainstack.
  2. Create three cards: sequence, conditional, looping, for each of the three following sections.

Card 1: Sequence of Commands

Create all of the controls you need to complete this problem. For example, for this problem, you'll need at a minimum one field and one button. There is a file called sentences.txt in the Media/text folder on the server that you can use if you wish.

Problem: Given a list of sentences or words, delete all of the even numbered lines. Don't use a repeat loop for this (even though in real life you would probably use one.)

Card 2: if - then - else (conditional) structures

For this activity, copy the objects from the previous card and paste them here. Add other controls as needed.

Problem: Using the previous activity, create a set of radio buttons that lets the user choose between "Delete Odd" and "Delete Even". If the "odd" button is highlighted, delete the odd numbered lines; if the "even" button is highlighted, delete the even numbered lines.

Card 3: repeat loop structures

Create whatever controls you may need for these two activities. There are suitable text files for each activity in the media/text folder on the server.

  1. For the first part, look for "SampleSentences.txt" and "SampleSentences2.txt".

    Problem: Given a long list of sentences separated by returns, take the third word of each sentence and combine them into one long "nonsense" sentence.

  2. For the next activity you may want to use 1Nephi.txt in the media/text folder.

    Problem: Create a simple concordancer. Discover how many times each word occurs in a text and create a list of each word, followed by a count of the number of times it occurs in the text.


Back     BYU LiveCode Lessons Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University