A tip for using arrayappend in Lotus script

Source: Internet
Author: User

When arrayappend is used in Lotus script, the syntax is roughly as follows:
Array1 = arrayappend (array1, array2)
As the name implies, array2 is merged into array1. According to help, array2 is not necessarily a series, but array1 must be a series!
This requirement is annoying, because it means that when we create an array from 0, we cannot use arrayappend, which is very useful. Instead, we need to endlessly redim The for loop.
That is to say, the following seemingly reasonable statement will be prompted as not compliant with the syntax.
V = 1
V = arrayappend (v, 2)
But we know that if V is a series, there will be no such problem. If you don't want redim, the following tips will be very useful.
V = Split (1)
V = arrayappend (v, 2)

Split will force us to create a series, and there is only one value in this series, that is, 1. This will not destroy the value of V, but also solve the syntax problem.

A practical application is:

Dim I as integer, numberlist as variantnumberlist = Split (1) for I = 2 to 20 numberlist = arrayappend (numberlist, I) nextprint join (numberlist, ",") 'prints 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.