How to resolve the algorithm Loops/Foreach step by step in the Action! programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Loops/Foreach step by step in the Action! programming language

Table of Contents

Problem Statement

Loop through and print each element in a collection in order. Use your language's "for each" loop if it has one, otherwise iterate through the collection in order with some other loop.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Loops/Foreach step by step in the Action! programming language

Source code in the action! programming language

PROC Main()
  DEFINE PTR="CARD"
  BYTE i
  PTR ARRAY items(10)
  items(0)="First"   items(1)="Second"
  items(2)="Third"   items(3)="Fourth"
  items(4)="Fifth"   items(5)="Sixth"
  items(6)="Seventh" items(7)="Eighth"
  items(8)="Ninth"   items(9)="Tenth"

  PrintE("In Action! there is no for-each loop")
  PutE()
  FOR i=0 TO 9
  DO
    PrintE(items(i))
  OD
RETURN

  

You may also check:How to resolve the algorithm Sum to 100 step by step in the Sidef programming language
You may also check:How to resolve the algorithm Random number generator (included) step by step in the Ring programming language
You may also check:How to resolve the algorithm Increment a numerical string step by step in the Factor programming language
You may also check:How to resolve the algorithm Distribution of 0 digits in factorial series step by step in the Arturo programming language
You may also check:How to resolve the algorithm Palindrome dates step by step in the Nim programming language