call in the DuScript

·

1 min read

call

call - calls a variable or function

Sample:

call [call-type] [type] [name];

The call-type parameter indicates what is being called, there are two types of call:

  • variable

  • function

The type parameter is only needed if the call-type is "variable" , there are five types in total:

  • v

v - used when displaying text and numbers

Sample:

approve msg = String string;
call variable v msg;
approve msg1 = Int 12;
call variable v msg1;

Will: string Will: 12

  • Array

Array - for outputting arrays

Sample:

approve msg = Array [1,2,3];
call variable Array msg 1;

Will: 2

  • Object

Object - to display an object

Sample:

approve msg = Object {
    "a": 1
};
call variable Object msg.a;

Will: 1

  • @

@ - reference to the global variable object

Sample:

approve msg = Int 1;
call variable @;

Will: { msg: 1 }

  • !

! - access to the global object comment

Sample:

// :)
call variable !;

Will: :)

If the call-type is specified as "function" then the type parameter is not needed