electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Faux Pas Quartet and friends Music From Last Thursday
Please visit the chat
 Forum index » DIY Hardware and Software » ChucK programming language
newbie: question about string output, when is type printed
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
abs_zero



Joined: Oct 27, 2013
Posts: 1
Location: NYC

PostPosted: Mon Oct 28, 2013 12:08 am    Post subject:  newbie: question about string output, when is type printed
Subject description: Chuck String Output adds type in parenthesis when no comma is found
Reply with quote  Mark this post and the followings unread

How come when you leave out comma concatenation, it prints out the type , but when you include the comma it doesn't?

Example:
<<< now / second, "seconds" >>>;

yields:
10906.540408 seconds

but removing the comma and just printing the expression:
<<< now / second >>>;

yields the following:
10964.996644 :(float)

it basically appends :(float) to the value output, but doesn't do it when there's a concatenation present.

note: i'm using miniaudicle for windows 7, but it's the same output in command line.
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 3701
Location: Sweden
Audio files: 270
G2 patch files: 96

PostPosted: Mon Oct 28, 2013 4:20 am    Post subject: Re: newbie: question about string output, when is type printed
Subject description: Chuck String Output adds type in parenthesis when no comma is found
Reply with quote  Mark this post and the followings unread

abs_zero wrote:
How come when you leave out comma concatenation, it prints out the type , but when you include the comma it doesn't?

Example:
<<<now>>>;

yields:
10906.540408 seconds

but removing the comma and just printing the expression:
<<<now>>>;

yields the following:
10964.996644 :(float)

it basically appends :(float) to the value output, but doesn't do it when there's a concatenation present.

note: i'm using miniaudicle for windows 7, but it's the same output in command line.


I guess it can be interesting to see the type of stuff you print out sometimes, so when you use <<< >>> with a single argument it will add the type to the printout. I think you can see this if you just print out a single string too (e.g. <<< "hello" >>>;). But the ChucK people felt that ChucKers will probably want to be able to format the printouts without type info too, so they left the type stuff out of the multiple arguments version of <<< >>>.

(Incidentally I think I just realised why I used to see a lot of (string) endings to my printouts - I used to concatenate using + so I used the single argument version, e.g. <<< "The number is: " + number >>>; )

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use