Changes between Version 3 and Version 4 of IoWithMangoExample
- Timestamp:
- 04/27/06 01:21:48 (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IoWithMangoExample
v3 v4 5 5 == Description == 6 6 7 Shows you how to use the Mango library for I/O.7 Shows you how to use the Mango library for console I/O. 8 8 9 9 == Example == 10 10 11 The following example uses Mango's "Whisper" syntax:12 13 11 {{{ 14 12 #!d 15 import mango.io.Stdout; 16 import mango.io.Stdin; 13 import mango.io.Console; 17 14 18 intmain()15 void main() 19 16 { 20 Stdout ("MANGO I/O EXAMPLE 1"c) (CR) (CR); //The 'c' postfix is necessary to identify the string as UTF8 21 22 char[] name; 17 char[] name; 23 18 24 Stdout ("NAME: "c) (); //Usually a flush only occurs with a line feed, so we trigger it manually with () 25 Stdin (name); 26 27 Stdout (CR) (CR) ("Hello, "c) (name) ("; how are you?"c) (CR); 28 29 return 0; 19 Cout ("mango IO example #1").newline.newline; 20 Cout ("What is your name? "); 21 Cin (name); 22 Cout ("Hello, ") (name); 30 23 } 31 24 32 }}}33 34 This next example uses Mango's original method syntax:35 36 {{{37 #!d38 import mango.io.Stdout;39 import mango.io.Stdin;40 41 int main()42 {43 Stdout.put("MANGO I/O EXAMPLE 1"c).put(CR).put(CR); //The 'c' postfix is necessary to identify the string as UTF844 45 char[] name;46 47 Stdout.put("NAME: "c).flush; //Usually a flush only occurs with a line feed, so we trigger it manually48 Stdin.get(name);49 50 Stdout.put(CR).put(CR).put("Hello, "c).put(name).put("; how are you?"c).put(CR);51 52 return 0;53 }54 25 }}} 55 26