程序中不允许的功能 [英] Function not allowed within a procedure
本文介绍了程序中不允许的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个任务要在LibreOffice中编写一个宏,该宏将使用XOR操作对消息进行编码.我遇到了问题:程序中不允许使用该功能.当我尝试运行宏时. 这是代码:
I have an assignment to write a macro in LibreOffice that will code a message using XOR operation. I get the problem: Function not allowed within a procedure. when I try to run the macro. This is the code:
REM ***** BASIC *****
Sub Main
end Sub
function izracunajHash(geslo, zacetni_hash)
zacetni_hash = 17520
hash = zacetni_hash
mask = &H00FFFFFF
dolzina = len(geslo)
If dolzina > 0 Then
for f=1 to dolzina step +1
podniz = mid(geslo,dolzina,1)
char = Asc(podniz)
hash = 33*hash + char
hash = hash AND mask
dolzina = dolzina +1
hash = hash AND &H00FFFFFF
next f
izracunajHash = hash
End function
function kodiraj(niz) //this is where the problem occurs according to LibreOffice
y = 1
if Len(niz) > 0 Then
x = Len(niz)
Do While y > (x+1)
sign = Mid(niz, y, 1)
z1 = Asc(sign)
if z1 > 31 Then
z2 = (CInt(rnd()*31))
z1 = z1 XOR z2
z1 = Chr(z1)
Mid(niz,y,1,z1)
End If
y = y + 1
Loop
End If
kodiraj = niz
End function
先谢谢了. (我剪切了一些我自己不需要写的不重要的代码)
Thanks in advance. (I cut some unimportant code that I didn't have to write myself)
推荐答案
在第一个函数中,您有一个if语句,但没有相应的End If.
In your first function you have an if statement without a corresponding End If.
这篇关于程序中不允许的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文