Operators
V supports the following operators:
Basic Operators
+(addition) for int, float and string-(subtraction) for int and float*(multiplication) for int and float/(division) for int and float%(modulos) for int=(assignment) for changing values:=for initialising values
println(3 + 5)
println(2.0 + 5.0)
println('hello' + 'world')
println(9 - 10)
println(7.0 - 5.0)
println(3 * 5)
println(2.0 * 4)
println(23 / 3)
println(25.0 / 5.0)
println(27 % 5)
println(27 % 3)Output
8
7.0
hello world
-1
2.0
15
8.0
7
5.0
2
0Note: Unlike other languages, V doesn't allow modulus with float.
Comparison Operators
>greater than<lesser than==equal to>=greater than or equal to<=lesser than or equal to!=not equal to
Boolean Operators
&&and||or!not
Bitwise Operators
<<left bitshift>>right bitshift&bitwise and|bitwise or^bitwise xor
Assignments Operators
+=same asfoo = foo + var-=same asfoo = foo - var*=same asfoo = foo * var/=same asfoo = foo / var&=same asfoo = foo & var|=same asfoo = foo | var>>=same asfoo = foo >> var<<=same asfoo = foo << var
Special Operators
infor membershipnonefor optional
Last updated
Was this helpful?