Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » [SOLVED]Can I use "varargs" with proc?(=> No, you have to use "[list a b c]")
icon5.gif  [SOLVED]Can I use "varargs" with proc? [message #1440506] Wed, 08 October 2014 13:00 Go to next message
Francis BACQUET is currently offline Francis BACQUETFriend
Messages: 46
Registered: September 2014
Member
Hello,

I have a new question.
Can I create proc without limit args? As args with TCL

Sample code:
proc test [val message] [val args] {
    show-alert $message 
    $args  | foreach { | equals "test" | verify-true }
}

test "message" "test" "test" "test" "test3"

[Updated on: Thu, 09 October 2014 12:20]

Report message to a moderator

Re: Can I use "varargs" with proc? [message #1440962 is a reply to message #1440506] Thu, 09 October 2014 04:29 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

Hi,

Unfortunately no. But lists might be helpful:
proc test[val list] {
$list | each [val elem] { ... }
}

test [list a b c]


Yours sincerely,
Olga.
Re: Can I use "varargs" with proc? [message #1441074 is a reply to message #1440962] Thu, 09 October 2014 08:17 Go to previous message
Francis BACQUET is currently offline Francis BACQUETFriend
Messages: 46
Registered: September 2014
Member
Alright, I will use lists.

A sample code with few lists:
proc demo [val numberList][val textList] [val symbolList] [val display true]{
    if [$display | eq true] {
	    $numberList | each [val text] {show-alert [concat "number " $text]}
	    $textList | each [val text] {show-alert [concat "text " $text]}
	    $symbolList | each [val text] {show-alert [concat "symbol " $text]}
	}
}

//do nothing
demo [list 1 2 3 4 5] [list one two three four five] [list "*" "=" "%" "-" "+"] false
//display every list with different message
demo [list 1 2 3 4 5] [list one two three four five] [list "*" "=" "%" "-" "+"]


thanks for your answer.

[Updated on: Thu, 09 October 2014 08:19]

Report message to a moderator

Previous Topic:RCPTT tutorial
Next Topic:Number are modified as arguments
Goto Forum:
  


Current Time: Thu Apr 25 12:03:08 GMT 2024

Powered by FUDForum. Page generated in 0.02814 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top