Page 7: Summary - Printable Version +- Curl Global Community (https://communities.curl.com) +-- Forum: Tutorials (https://communities.curl.com/forumdisplay.php?fid=3) +--- Forum: Public Training (https://communities.curl.com/forumdisplay.php?fid=4) +---- Forum: Curl IDE Made Easy (https://communities.curl.com/forumdisplay.php?fid=6) +----- Forum: Try 5: Reading Our Score Data (https://communities.curl.com/forumdisplay.php?fid=13) +----- Thread: Page 7: Summary (/showthread.php?tid=77) |
Page 7: Summary - ashimo - 06-20-2011 TRY 5 Summary Reading and writing data from/to a file Step 1. Specifying the location of a file Code: let location_variable_name:Url = {url “path to file location”} Step 2. Opening file as a Stream
Code: let stream_variable_name:TextInputStream = {read-open location_variable_name} Step 3. Using methods to read or write data
Step 4. Closing the file Code: {if-non-null stream_variable_name then Repeat Expressions until expression (processing repeats until conditional expression is true) Code: {until conditional_expression do for expression (specifying a range) Code: {for repeat variable:int = initial_value to final_value step step_size value do As well as to, there are also the below, downto, and above keywords. The step_size can be omitted when the desired step_size is 1. for expression (repeats only the values among the elements of a collection, such as an array) Code: {for element_variable:element_type key key_variable[:key type] in (collection) name do Note that element_variable:Element_type or key key_variable: key_type can be omitted. Exception Processing Code: {try The catch and finally clauses can be omitted. Also, each try can be declared more than once. |