[Slurp] obtain. | Manual

[Slurp] obtain.

Obtains the string generated using the Slurp object. A Slurp object collects all messages send to it and flushes its buffer while returning the resulting string after an 'obtain' message has been received.

 Slurp hello world.
 Pen write: (Slurp obtain).
 This will output: 'hello world'.
 Use the Slurp object to integrate verbose shell commands, other programming languages
 (like SQL) etc into your main program without overusing strings.

 Note that we can't use the = and * unfortunately right now
 because = is also a method in the main object. While * can be used
 theoretically, it expects an identifier, and 'from' is not a real
 identifier, it's just another unary message, so instead of using a binary
 * we simply use a keyword message select: with argument '*' and then
 proceed our SQL query with a comma (,) to chain the rest.
 This is an artifact of the fact that the DSL has to be embedded within
 the language of Citrine. However even with these restrictions (some of which might be
 alleviated in future versions) it's quite comfortable and readable to interweave
 an external language in your Citrine script code.


 ☞ query := Slurp
	select: '*',
		user_id=: 1.

 #result: select * from users where user_id= 1

Welcome to the Citrine Online Manual Pages. This online manual has been generated automatically from source code comments using the shtml.ctr script. All Citrine documentation is also available as a UNIX manual file included in the download package. These pages are just a web version of the original Citrine Programming Language User Manual and Reference Guide.

Improve this manual

You can help to improve this manual. Any help is appreciated! If you spot an error in this manual or you want to contribute, just change the corresponding comment in the original Citrine Programming Language source code hosted on github and create a 'Pull Request'. After the documentation generation script has been invoked again the manual pages will be updated to reflect your contribution and so will these online manual pages.

About Citrine

Citrine is an easy to use programming language for everyone. Citrine is so simple it does not even need special syntax for loops or conditions. You can learn Citrine in just a couple of minutes. Citrine makes programming fun again! Visit the homepage for a quick tutorial.

back to homepage | back to manual menu | top of page