Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 1 and Version 2 of GotoExample

Show
Ignore:
Author:
csauls (IP: 69.166.134.113)
Timestamp:
01/23/06 08:51:19 (18 years ago)
Comment:

Updated to use writef, and other miscellany.

Legend:

Unmodified
Added
Removed
Modified
  • GotoExample

    v1 v2  
    1212#!d 
    1313/* 
    14  
    1514File:       goto.d 
    1615Date:       2004-02-16 
    1817License:    Public Domain 
    1918Purpose:    Shows the usage of goto and labels. 
     19Edited:     2006-01-23, Christopher Nicholson-Sauls 
    2020 
    2121Why goto is part of the D programming language... 
    3232*/ 
    3333 
     34import std.stdio; 
    3435 
    35 void main() 
    36 
     36void main () { 
    3737 
    3838thebeginning: 
    39     printf("The beginning\n"); 
     39    writefln("The beginning"); 
    4040 
    4141part1: 
    42     printf("Part 1\n"); 
     42    writefln("Part 1"); 
    4343 
    4444part2: 
    45     printf("Part 2\n"); 
     45    writefln("Part 2"); 
    4646    goto part5; 
    4747 
    4848part3: 
    49     printf("Part 3\n"); 
     49    writefln("Part 3"); 
    5050 
    5151part4: 
    52     printf("Part 4\n"); 
     52    writefln("Part 4"); 
    5353 
    5454part5: 
    55     printf("Part 5\n"); 
     55    writefln("Part 5"); 
    5656 
    5757theend: 
    58     printf("The end\n"); 
    59  
     58    writefln("The end"); 
    6059} 
    6160}}} 
    6261 
    63 == Source == 
    64  
    65 || Link || http://www.dsource.org/tutorials/index.php?show_example=89 || 
    66 || Posted by || jcc7 || 
    67 || Date/Time || Wed May 19, 2004 6:02 pm || 
     62== Output == 
     63{{{ 
     64The beginning 
     65Part 1 
     66Part 2 
     67Part 5 
     68The end 
     69}}}