Last change
on this file since 353 was 346, checked in by wouter, 2 years ago |
version 0.1 of automatic java to python translator. Can translate some simple programs, lot of work remains to be done
|
File size:
543 bytes
|
Rev | Line | |
---|
[346] | 1 | package testcode;
|
---|
| 2 |
|
---|
| 3 | import java.util.Arrays;
|
---|
| 4 |
|
---|
| 5 | public class ForIfCase {
|
---|
| 6 |
|
---|
| 7 | static public void main(String[] args) {
|
---|
| 8 | String res = "";
|
---|
| 9 | for (int n = 1; n < 10; n = n + 1) {
|
---|
| 10 | res = res + Integer.toString(n);
|
---|
| 11 | switch (n) {
|
---|
| 12 | case 0:
|
---|
| 13 | res = res + " ";
|
---|
| 14 | break;
|
---|
| 15 | case 1:
|
---|
| 16 | res = res + "-";
|
---|
| 17 | // FALLTHROUGH
|
---|
| 18 | case 2:
|
---|
| 19 | case 3:
|
---|
| 20 | res = res + "%";
|
---|
| 21 | break;
|
---|
| 22 | default: // nothing
|
---|
| 23 | }
|
---|
| 24 | if (n > 5)
|
---|
| 25 | res = res + "*";
|
---|
| 26 | }
|
---|
| 27 | for (String x : Arrays.asList("a", "b", "c")) {
|
---|
| 28 | res = res + x;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | System.out.println(res);
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.