Difference between revisions of "Manual:DIL Manual/Assignment"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import of LLM wiki pages)
 
(One intermediate revision by one other user not shown)
(No difference)

Latest revision as of 10:43, 4 December 2025


Assignment:

    You can assign values to the variables you declare
    in your 'var' section, and some of the built-in
    variables. This is  done by the ':=' operator.
    Note that you can also assign a variable the result
    of an expression
    (the addition of strings below as an example)
Example:

   dilbegin foo();
   var
     myvarsl : stringlist;
     myvars : string;
   code
   {
     :start:
     myvarsl := {"a string","another","the first"};
     myvars := self.name+" XX ";
     myvarsl.[2] := "the last";
     myvarsl.[3] := "illegal";  /* Will not work since [3] is not defined */
     pause;
     goto start:
   }
   dilend