Click or drag to resize

Next function

Next function lets you iterate in a string. It returns the first word of the string (i.e.: "23.4 word": "23.4" and "word" are considered two words) and deletes the the word from the string

Syntax

Default syntax: [var] = next [string]. Default value: void string.

//Read the file "data.txt"
[data] = readfile "data.txt"

//Check if the file is read correctly
if not(streq "{data}" "fileError") then
  //Read the first word in the string and save in the first element of the "var" vector
  [var0] = next [data]

  //while the string is not void, reads all the values of data and saves in an array
  [i] = 0
  loop not(streq "{var{i}}" "") then
    [i]++
    [var{i}] = next [data]
  endloop
else
output Error reading file!
endif