User Tools

Site Tools


4rpl:commands:setlistelement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:commands:setlistelement [2021/01/08 16:01] – external edit 127.0.0.14rpl:commands:setlistelement [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~NOTOC~~ + <=[[4rpl:start| Index]] \\ 
-<=[[4rpl:start| Index]] +<=[[4rpl:start#lists| Lists]] 
 +<WRAP tabs> 
 +  * [[4rpl:commands:getlistelement|Get]] 
 +  * [[4rpl:commands:setlistelement|Set]] 
 +</WRAP>
 ====== SetListElement ====== ====== SetListElement ======
 +
 SetListElement(<-list <-index <-value) SetListElement(<-list <-index <-value)
  
 ===== Description ===== ===== Description =====
 +
 Stores a value at the specified index of a list. The previously stored value is overwritten. Stores a value at the specified index of a list. The previously stored value is overwritten.
  
-If a list is stored in a variable, this can be abbreviated to <-value ->list[<-index].+If a list is stored in a variable, this can be abbreviated to ''<-value ->list[<-index]''
 + 
 +For doing the same thing but with arguments in order of **value, list**, **index**, see [[4rpl:commands:setlistelementrpn|SetListElementRPN]].
  
 ===== Examples ===== ===== Examples =====
 +
 <code 4rpl> <code 4rpl>
-Split("1,2,3,4,5,6" ",") ->list +1 2 3 4 5 6 ListN(6) ->list1 
-SetListElement(<-list 2 "G") +1 2 3 4 5 6 ListN(6) ->list2 
-"R" ->list[4+  
-Trace(<-list)+0 ->index 
 +  
 +SetListelement(<-list1 <-index "one") 
 +# does the same as 
 +"one" ->list2 [<-index
 +  
 +<-list1 Trace 
 +<-list2 Trace 
 +  
 +# OUTPUT: 
 +# [one, 2, 3, 4, 5, 6] 
 +# [one, 2, 3, 4, 5, 6]
 </code> </code>
 +
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
 +
 +~~NOTOC~~
  
4rpl/commands/setlistelement.1610121708.txt.gz · Last modified: 2025/02/14 14:56 (external edit)