Question: Help with for loop and if statement interaction

Hello.  I'm quite new to Maple and I've run into a problem.

My assignment is to create a program that takes input as plaintext, converts it into a matrix X using an alphabet, then encrypts it by multiplying the matrix X by a key matrix M.  Only problem is, I can't even get Maple to recognize a proper if statement.  The if statement is never triggered.

with(Maplets[Elements]):
with(StringTools):
with(LinearAlgebra):

block := 3;

maplet := Maplet(
    InputDialog['ID1']("Enter plaintext to encrypt",
       'onapprove'=Shutdown(['ID1']),
       'oncancel'=Shutdown()
)):
plaintext := Maplets[Display](maplet)[1];

# notes how much padding is required
if ((Length(plaintext) mod block) = 0) then
    pad := 0:
else
    pad := block - (Length(plaintext) mod block):
end if:

# will construct the list to feed into the Matrix(r,c,init)
for count from 1 by 1 while count <= (Length(plaintext) + pad) do
    if (count > Length(plaintext)) then

        # filler to see if Maple triggers the if statement
        count
    end if;
end do;

The for loop will construct a list to make a matrix.   The way we will encrypt is detailed here: Lecture Notes in Linear Algebra.  Check section 8.2.1 for examples.

I have tried printing count and Length(plaintext) within that same loop by changing it like so:

for count from 1 by 1 while count <= (Length(plaintext) + pad) do
    count;
    Length(plaintext);
end do;

The numbers print correctly, so I'm not sure what is going wrong.

Please Wait...