Skip to content

Commit f93b0f4

Browse files
committed
added the varargs versions of print() and println()
1 parent d4f8995 commit f93b0f4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

core/src/processing/core/PApplet.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,6 +3529,25 @@ static public void print(String what) {
35293529
System.out.flush();
35303530
}
35313531

3532+
/**
3533+
* @param variables list of data, separated by commas
3534+
*/
3535+
static public void print(Object... variables) {
3536+
StringBuilder sb = new StringBuilder();
3537+
for (Object o : variables) {
3538+
if (sb.length() != 0) {
3539+
sb.append(" ");
3540+
}
3541+
if (o == null) {
3542+
sb.append("null");
3543+
} else {
3544+
sb.append(o.toString());
3545+
}
3546+
}
3547+
System.out.print(sb.toString());
3548+
}
3549+
3550+
/*
35323551
static public void print(Object what) {
35333552
if (what == null) {
35343553
// special case since this does fuggly things on > 1.1
@@ -3537,6 +3556,7 @@ static public void print(Object what) {
35373556
System.out.println(what.toString());
35383557
}
35393558
}
3559+
*/
35403560

35413561
//
35423562

@@ -3570,6 +3590,15 @@ static public void println(String what) {
35703590
print(what); System.out.println();
35713591
}
35723592

3593+
/**
3594+
* @param variables list of data, separated by commas
3595+
*/
3596+
static public void println(Object... variables) {
3597+
// System.out.println("got " + variables.length + " variables");
3598+
print(variables);
3599+
println();
3600+
}
3601+
35733602
static public void println(Object what) {
35743603
if (what == null) {
35753604
// special case since this does fuggly things on > 1.1

0 commit comments

Comments
 (0)