Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing a line only once in a method  RSS feed

 
Matthew Moreno
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have this code that is supposed to print truth tables you'd encounter in a discrete math course. The code is as follows.

but the output is

b0 b1 b0 AND b1
b0 b1 b0 OR b1

true true true
true false false
false true false
false false false
b0 b1 b0 AND b1
b0 b1 b0 OR b1

true true true
true false true
false true true
false false false


Im trying to make it look like this

b0 b1 b0 AND b1
true true true
true false false
false true false
false false false
b0 b1 b0 OR b1
true true true
true false true
false true true
false false false


I've already figured out one way to do it

But im wondering if their is a way to print this using only the method

To try and make this code appear less...chunky.
 
Carey Brown
Bartender
Posts: 2980
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!