Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

euphoria
functions
append()
communitycreator

What is the append() function in Euphoria?

NDUKWE CHIDERA K.

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

In Euphoria, the append() function is one of the numerous functions which can perform special operations on the sequence data type. The append() function is used to add a new element to a sequence at the end. This new element has the last index number of the sequence.

The new sequence will have a greater length than the original sequence.

Syntax

append(sequence,newElement)

Parameters

  • sequence: This parameter is the sequence to which we’ll add a new element.
  • newElement: This parameter is the element that is appended at the end of the sequence.

Return value

This function returns another sequence that has the new item added. The returned sequence will be +1 in length compared to the original sequence.

Example

## declare some sequence
sequence append1, append2, someSeq1, someSeq2
## assign values to some of the sequence declared
someSeq1 = {7,8, 9}
someSeq2 = {4,5,6}
## call the append function ,save it value.
append1 = append({1,2,3},10)
append2 = append(someSeq1,someSeq2)
##print the return value of the append function.
print(1,append1)
puts(1,"\n")
print(1,append2)

Explanation

  • Line 2–6: We add comments for all declarations and assignment of values.

  • Line 9: We call the append() function and save the return value. We append the atom 9 at the end of the sequence {1,2,3}.

  • Line 10: We append another sequence someSeq2 to the end of someSeq1.

  • Line 13–15: We print the output.

RELATED TAGS

euphoria
functions
append()
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring