-1

I try to programm a decimal to binary converter in MakeCode for bbc:microbit. The logic of my code is this function for python and it works:

def dezimal_zu_binaer(dezimalzahl):
    if dezimalzahl == 0:
        return '0'
    if dezimalzahl < 0:
        return 'kein Support'
    
    binaer = ''
    while dezimalzahl > 0:
        rest = dezimalzahl % 2
        binaer = str(rest) + binaer
        dezimalzahl //= 2
    
    return binaer

I wanted to use my function also for visual programming with microbit with MakeCode. Whenever I press the buttonA it should show me the binary code. But it shows nothing on the microbit, there is also no error or warning.

This is my code in MakeCode

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Mario W.
  • 1
  • 1

0 Answers0