loops - Print text multiple times in Brainfuck -


i tried out hello world program in brainfuck. how can print text multiple number of times? here's code:

+++++++[>++++++++++ <- ] >++.>++++++[>++++++++++ <- ] >+++++++++.>+++++++[>++++++++++ <- ] >++++++..>+++++++[>++++++++++ <- ] >+++++++++.>+++[>++++++++++ <-]>++. >++++++++[>++++++++++<-]>+++++++.>+++++++[>++++++++++<-] >+++++++++.>++++++++[>++++++++++ <-]>++.>+++++++[>++++++++++ <- ] >++++++.>++++++[>++++++++++ <-]>++++++++.>+++[>++++++++++<-]>++.>+++[>++++++++++<-]>+++.>+++[>++++++++++<-]>+++. 

let's think of 5 character long word "hello".

so if want print 5 characters 3 times have code this:

,>,>,>,>,>+++[<<<<<.>.>.>.>.>-] 

let me explain code:

the first part of code input part:

,>,>,>,>, 

then initialize variable containing information want print 3 times.

>+++ 

then have loop goes start, prints out 5 characters, , goes variable , decrement it.

[<<<<< //goes  .>.>.>.>. //print out  >-]  //decrement 

if got idea, can improve code e.g. putting more loops in it, wanted show simple idea.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -